Loading ...
Sorry, an error occurred while loading the content.
 

wish return DOS (short) form of NAME

Expand Messages
  • Xiangjiang Ma
    Hi, For vim for win32, can we have an option to return DOS filename? How about %:P, %:P:H, etc (captital letter)? Reason: for those poor Windows users, :set
    Message 1 of 6 , Mar 2, 2003
      Hi,


      For vim for win32, can we have an option to return DOS filename?

      How about %:P, %:P:H, etc (captital letter)?

      Reason: for those poor Windows users, :set ssl<CR> helps a lot.
      But space in the filename is a constant trouble. Recently, after
      using gvim.exe 6.1.358, I found my following favorite map is broken:

      nme <silent>PopUp.Open_IE_&View :norm :sil! !start
      C:/Progra~1/intern~1/iexplore -nohome "%:p"<CR>


      Thanks


      --
      Xiangjiang Ma
      maxiangjiang@...
      www.clarkson.edu/~maxi




      _________________________________________________________________
      STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
      http://join.msn.com/?page=features/junkmail
    • Bram Moolenaar
      ... Is there always a short name? E.g., on NTFS file systems. -- If corn oil comes from corn, where does baby oil come from? /// Bram Moolenaar --
      Message 2 of 6 , Mar 3, 2003
        Xiangjiang Ma wrote:

        > For vim for win32, can we have an option to return DOS filename?
        >
        > How about %:P, %:P:H, etc (captital letter)?
        >
        > Reason: for those poor Windows users, :set ssl<CR> helps a lot.
        > But space in the filename is a constant trouble. Recently, after
        > using gvim.exe 6.1.358, I found my following favorite map is broken:
        >
        > nme <silent>PopUp.Open_IE_&View :norm :sil! !start
        > C:/Progra~1/intern~1/iexplore -nohome "%:p"<CR>

        Is there always a short name? E.g., on NTFS file systems.

        --
        If corn oil comes from corn, where does baby oil come from?

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
      • Xiangjiang Ma
        Bram Is there always a short name? E.g., on NTFS file systems. I believe so. From google, I searched dos short name tip , and found a good one.
        Message 3 of 6 , Mar 3, 2003
          Bram>Is there always a short name? E.g., on NTFS file systems.

          I believe so.

          From google, I searched "dos short name tip", and found a good one.
          http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvbtips/html/msdn_msdn207.asp

          It is for win95, but I believe all windows OSes shares the same convention,
          and every filename for windows has a one-to-one match to DOS short name.

          Also, from cygwin, I can have filename using cygpath: such as

          Usage: cygpath (-d|-m|-u|-w|-t TYPE) [-c HANDLE] [-f FILE] [options] NAME
          cygpath [-ADHPSW]
          Output type options:
          -d, --dos print DOS (short) form of NAME (C:\PROGRA~1\)
          -m, --mixed like --windows, but with regular slashes (C:/WINNT)
          -u, --unix (default) print Unix form of NAME
          (/cygdrive/c/winnt)
          -w, --windows print Windows form of NAME (C:\WINNT)
          -t, --type TYPE print TYPE form: 'dos', 'mixed', 'unix', or
          'windows'
          Path conversion options:
          -a, --absolute output absolute path
          -l, --long-name print Windows long form of NAME (with -w, -m only)
          -p, --path NAME is a PATH list (i.e., '/bin:/usr/bin')
          -s, --short-name print DOS (short) form of NAME (with -w, -m only)
          System information:
          -A, --allusers use `All Users' instead of current user for -D, -P
          -D, --desktop output `Desktop' directory and exit
          -H, --homeroot output `Profiles' directory (home root) and exit
          -P, --smprograms output Start Menu `Programs' directory and exit
          -S, --sysdir output system directory and exit
          -W, --windir output `Windows' directory and exit


          --
          Xiangjiang Ma

          >From: Bram Moolenaar <Bram@...>
          >To: "Xiangjiang Ma" <maxiangjiang@...>
          >CC: vim@...
          >Subject: Re: wish return DOS (short) form of NAME
          >Date: Mon, 03 Mar 2003 10:27:56 +0100
          >
          >Xiangjiang Ma wrote:
          >
          > > For vim for win32, can we have an option to return DOS filename?
          > >
          > > How about %:P, %:P:H, etc (captital letter)?
          > >
          > > Reason: for those poor Windows users, :set ssl<CR> helps a lot.
          > > But space in the filename is a constant trouble. Recently, after
          > > using gvim.exe 6.1.358, I found my following favorite map is broken:
          > >
          > > nme <silent>PopUp.Open_IE_&View :norm :sil! !start
          > > C:/Progra~1/intern~1/iexplore -nohome "%:p"<CR>
          >
          >Is there always a short name? E.g., on NTFS file systems.
          >
          >--
          >If corn oil comes from corn, where does baby oil come from?
          >
          > /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net
          >\\\
          >/// Creator of Vim - Vi IMproved -- http://www.Vim.org
          >\\\
          >\\\ Project leader for A-A-P -- http://www.A-A-P.org
          >///
          > \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html
          >///


          _________________________________________________________________
          Tired of spam? Get advanced junk mail protection with MSN 8.
          http://join.msn.com/?page=features/junkmail
        • Antoine J. Mechelynck
          ... NTFS I don t know. Unix-like filesystems (ext2, ext3, ...) don t have them. I think there are two hitches: (1) The short name cannot be deduced from the
          Message 4 of 6 , Mar 3, 2003
            Bram Moolenaar <Bram@...> wrote:
            > Xiangjiang Ma wrote:
            >
            > > For vim for win32, can we have an option to return DOS filename?
            > >
            > > How about %:P, %:P:H, etc (captital letter)?
            > >
            > > Reason: for those poor Windows users, :set ssl<CR> helps a lot.
            > > But space in the filename is a constant trouble. Recently, after
            > > using gvim.exe 6.1.358, I found my following favorite map is broken:
            > >
            > > nme <silent>PopUp.Open_IE_&View :norm :sil! !start
            > > C:/Progra~1/intern~1/iexplore -nohome "%:p"<CR>
            >
            > Is there always a short name? E.g., on NTFS file systems.
            >
            > --
            > If corn oil comes from corn, where does baby oil come from?
            >
            > /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net
            > \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org
            > \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org
            > /// \\\ Help AIDS victims, buy at Amazon --
            > http://ICCF.nl/click1.html ///

            NTFS I don't know. Unix-like filesystems (ext2, ext3, ...) don't have them.

            I think there are two hitches:
            (1) The short name cannot be deduced from the long name (nor, of course,
            vice-versa) without an access to the filesystem: If, for example, a single
            directory has subdirectories "Program Files" and "Program Configuration
            Files", whichever of them was created first will be PROGRA~1 and the other
            one will be PROGRA~2
            (2) Linux systems can access both Linux native filesystems (ext2 etc.) where
            there are no short names, and vfat (FAT32 etc.) filesystems, where both
            short and long names are valid.

            IMHO, if the possibility is added to transform a long name into a short name
            and/or vice-versa, it should be possible not only on dos-like operating
            systems, but also on Unix-like operating systems when accessing a
            Windows-like filesystem.

            Tony.
          • Bruce Mellows
            From the Win32 API (exists from win95 and NT3.1 onwards) HANDLE FindFirstFile(LPCTSTR pattern, LPWIN32_FIND_DATA pData) BOOL FindClose(HANDLE h) so...
            Message 5 of 6 , Mar 3, 2003
              From the Win32 API (exists from win95 and NT3.1 onwards)

              HANDLE FindFirstFile(LPCTSTR pattern, LPWIN32_FIND_DATA pData)
              BOOL FindClose(HANDLE h)

              so...

              LPWIN32_FIND_DATA data;
              HANDLE h = FindFirstFile(pchExactPathName, &data);
              if (h)
              {
              const char* pchEightPointThreeName = data.cAlternateFileName; //
              FIXME - take a copy
              FindClose(h);
              }

              Bram Moolenaar wrote:

              >Xiangjiang Ma wrote:
              >
              >
              >
              >>For vim for win32, can we have an option to return DOS filename?
              >>
              >>How about %:P, %:P:H, etc (captital letter)?
              >>
              >>Reason: for those poor Windows users, :set ssl<CR> helps a lot.
              >>But space in the filename is a constant trouble. Recently, after
              >>using gvim.exe 6.1.358, I found my following favorite map is broken:
              >>
              >>nme <silent>PopUp.Open_IE_&View :norm :sil! !start
              >>C:/Progra~1/intern~1/iexplore -nohome "%:p"<CR>
              >>
              >>
              >
              >Is there always a short name? E.g., on NTFS file systems.
              >
              >
              >
            • George V. Reilly
              ... In general, no, Windows file systems are not required to provide short names/long names. NTFS normally provides short filenames, but this can be disabled
              Message 6 of 6 , Mar 3, 2003
                > Bram>Is there always a short name? E.g., on NTFS file systems.

                In general, no, Windows file systems are not required to provide short
                names/long names. NTFS normally provides short filenames, but this can be
                disabled via the registry. The best way to find out the short/long names is
                to use GetShortPathName [1] and GetLongPathName [2] (be sure to read the
                note about the Win95 and NT4 implementation for GLPN).

                [1]
                http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/getshortpathname.asp
                [2]
                http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/getlongpathname.asp


                --
                Remember, Information is not knowledge; Knowledge is not Wisdom;
                Wisdom is not truth; Truth is not beauty; Beauty is not love;
                Love is not music; Music is the best.
                -- Frank Zappa
                (Get Witty Auto-Generated Signatures from http://SmartBee.org)
                /George V. Reilly mailto:george@...
                http://george.reilly.org
                Read my blog: http://erablog.net/blogs/george_v_reilly/
              Your message has been successfully submitted and would be delivered to recipients shortly.