• Login
Community
  • Login

Find in File use entered path (case insensitive)

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
9 Posts 4 Posters 831 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    Martin Oberhänsli
    last edited by Jan 24, 2022, 1:54 PM

    I try it in Version 8.2:

    If I enter a directory manually with “Browse in files” without paying attention to the effective capitalization, I can open a found file with a double-click. The file will be opened under my entered path. The path I entered will be used instead of the case-sensitive effective path. Basically no problem, but for example the NppFTP plugin cannot save the file on my FTP-Server because the incorrect upper and lower case letters. Therefore, when opening a file, it should not use my entered path, but the effective path of the file.

    Notepad.png

    The effective existing path ist C:\Users\marti\test. C:\Users\marti\TEST doesn’t exist.

    A P 2 Replies Last reply Jan 24, 2022, 2:00 PM Reply Quote 0
    • A
      Alan Kilborn @Martin Oberhänsli
      last edited by Alan Kilborn Jan 24, 2022, 2:01 PM Jan 24, 2022, 2:00 PM

      @martin-oberhänsli said in Find in File use entered path (case insensitive):

      The path I entered will be used instead of the case-sensitive effective path.

      I see that you have Follow current doc. ticked:

      f6ee26a9-ec9a-4c4e-b270-fc95b47ecb0e-image.png

      With that ticked, when you are editing (in the active editing pane’s tab) and you initiate Find in Files (with Ctrl+Shift+f, say), then the Directory box contents get overwritten with that path of the active file.

      But… sometimes one leaves the Find in Files window open and works with several tabs in different paths. In that case, to refresh the Directory box, untick Follow current doc. and then re-tick it. The currently active file’s path will then be put there.

      Unless there’s more to the problem, I’d think that would solve it.

      1 Reply Last reply Reply Quote 2
      • P
        PeterJones @Martin Oberhänsli
        last edited by Jan 24, 2022, 2:03 PM

        @martin-oberhänsli said in Find in File use entered path (case insensitive):

        The effective existing path ist C:\Users\marti\test. C:\Users\marti\TEST doesn’t exist.

        Windows is case-insensitive with regard to filenames. Windows will display the name as whatever case you happened to use when you initially saved it, but will allow accessing the file when typed as any case. Notepad++ isn’t part of that equation at all. Thus, if you are typing the filename rather than selecting with file-selector tools, the onus is on you, the one typing, to type the name “properly”, and the Windows OS provides no protection. Notepad++ is just letting Windows OS be Windows OS.

        It looks like while I was answering, Alan gave a suggestion which will help you work around this limitation in your operating system – so Notepad++'s pretty awesome, to be able to help you overcome design decisions in the OS. WooHoo!

        1 Reply Last reply Reply Quote 3
        • A
          Alan Kilborn
          last edited by Jan 24, 2022, 2:35 PM

          My use case is that I never type INTO the Directory box. I always have Follow current doc. ticked for automatic entry, and for any other use I’m pasting data into the Directory box that was copied from another source.

          The moral of that story is that you really can’t get a path wrong with those methods.

          1 Reply Last reply Reply Quote 2
          • M
            Martin Oberhänsli
            last edited by Feb 3, 2022, 5:33 PM

            @alan-kilborn said in Find in File use entered path (case insensitive):

            With that ticked, when you are editing (in the active editing pane’s tab) and you initiate Find in Files (with Ctrl+Shift+f, say), then the Directory box contents get overwritten with that path of the active file.
            But… sometimes one leaves the Find in Files window open and works with several tabs in different paths. In that case, to refresh the Directory box, untick Follow current doc. and then re-tick it. The currently active file’s path will then be put there.
            Unless there’s more to the problem, I’d think that would solve it.

            I only discovered the “error” because, exceptionally, I wrote in the field myself. I believe that a file should be opened with the real path and not with a path I typed. That a file is found despite my “wrong path” is actually nice.

            A 1 Reply Last reply Feb 3, 2022, 6:18 PM Reply Quote 0
            • A
              Alan Kilborn @Martin Oberhänsli
              last edited by Feb 3, 2022, 6:18 PM

              I’m not sure at all what you mean here.

              @martin-oberhänsli said :

              I believe that a file should be opened with the real path and not with a path I typed.

              I don’t know that this makes sense.
              What you type is what is opened as a directory…or it tries to.
              If it is a non-existent path it will do nothing more.

              That a file is found despite my “wrong path” is actually nice.

              Not sure how this could even happen.

              1 Reply Last reply Reply Quote 0
              • G
                gstavi
                last edited by Feb 3, 2022, 8:40 PM

                Note that you have a tricky requirement. You say “I may be using wrong case, fix it for me.”
                But, if you are looking for Files/sample/foo.c, a Linux file system may have all of these:
                Files/SAMPLE/FOO.c
                fILES/sample/foo.c
                files/sample/foo.c

                Which of them do you want to open/overwrite?

                You could want Notepad++ to carefully check along the entire path that there are no-case duplicate, but that is a very tricky thing to do. And since you claim your problem is with NppFTP (which I never used) I am not even sure if it is possible.

                The thing that Notepad++ may be able to do is to add case-sensitive path option for find in files. Validate the directory you entered is a case match for an actual directory and FAIL if it is not. Allowing you to fix the problem earlier rather than later.

                That way trying to search in Files/SAMPLE when there is only files/sample in the file system will fail. It is still a tricky feature because Notepad++ will need to open directory by directory and do a case sensitive compare against folders that Windows will find regardless of case.
                If you want it open a feature request on github.

                For now, just be careful with your cases.

                P 1 Reply Last reply Feb 3, 2022, 8:45 PM Reply Quote 2
                • P
                  PeterJones @gstavi
                  last edited by Feb 3, 2022, 8:45 PM

                  @gstavi said in Find in File use entered path (case insensitive):

                  For now, just be careful with your cases.

                  or @Martin-Oberhänsli should stop manually typing the path, and just use “follow current directory” (as @Alan-Kilborn already suggested) or the ... directory chooser or RightClick > Current Dir Path to Clipboard then paste the path into the Directory field – any of which would always get the right case for the directory.

                  G 1 Reply Last reply Feb 5, 2022, 10:37 AM Reply Quote 1
                  • G
                    gstavi @PeterJones
                    last edited by Feb 5, 2022, 10:37 AM

                    @PeterJones
                    Follow current directory is part of “be careful with your cases”. It seems to work, probably since Windows open file dialog fixes it. Not sure exactly what will happen over SAMBA share if there are actually case conflicts.

                    RightClick > Current Dir Path to Clipboard - doesn’t work. If a file was opened as described, from Find-in-Files with bad path case, Notepad++ just copies the wrong-case path it registered for the file.

                    1 Reply Last reply Reply Quote 2
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors