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

Re: why does vim change the file type?

Expand Messages
  • Benji Fisher
    ... Perhaps the second item from the FAQ at http://macvim.swdev.org/OSX/#FAQ will help here. (I think the same advice applies for any version of vim and Mac
    Message 1 of 5 , Jun 4, 2003
    • 0 Attachment
      Bodhi wrote:
      > This has nothing to do with "carbonization", rather it has a bit to do
      > with resource forks.
      >
      > Unless I have missed something fairly obvious, the command line version
      > of Vim doesn't write resource forks. Mac OS 9 apps often require at
      > least the existence of resource forks, if not specific content in the
      > resource fork. In Mac OS X resource forks are supported by the Finder
      > and most file systems, but are not required partially because UNIX apps
      > in general usually don't expect them or know how to deal with them. I
      > think that the official line that I read on the developer site was
      > something like "don't rely on them but it is nice to put them in for
      > backwards compatibility," which would seem to make sense in your situation.
      >
      > Options you have:
      > -File a bug with the good folks doing Vim development and ask them to at
      > least handle them gracefully if they are there. Having not done any
      > research into the issue and just reading your email, it appears that
      > there was a resource fork before you began editing it with Vim but when
      > Vim saved the file it didn't save the existing resource fork. Perhaps
      > the UNIX Vim source should check if it is Mac OS X and if the file has
      > an existing resource fork make sure they save it. If someone wants to do
      > this I can probably dig up what to call to do this - I would guess it is
      > in CoreFoundation. (Sure there are things in Carbon, but who wants to
      > link against that if they don't have to - esp in the UNIX version.)
      > -Until then try the SetFile command line utility. It is installed with
      > the Mac OS X Developer Tools in the /Developer/Tools directory. You
      > could probably rig an alias so that you just say "make9Openable" and it
      > runs SetFile with the appropriate arguments. Off the top of my head I
      > don't know what the appropriate arguments are but I would try setting
      > the -c and -d options. It probably doesn't matter what you set them to,
      > it is probably just their existence that matters. See the SetFile manual
      > page for examples (man SetFile in Terminal). That man page won't be
      > there unless you have the Dev Tools and I think the Dev Documentation
      > package installed.
      >
      > Hope that helps somewhat.

      Perhaps the second item from the FAQ at
      http://macvim.swdev.org/OSX/#FAQ
      will help here. (I think the same advice applies for any version of vim and Mac
      OS.)

      # How can I keep file creators and other meta data when I save a file with vim?
      If you

      :set backupcopy=yes

      then you can edit files with Vim without changing their creator codes, so that
      opening them from the Finder will still launch the application that created
      them. New files that you write with Vim will still get Vim's creator code. For
      details, read

      :help 'backupcopy'

      HTH --Benji Fisher
    • Eugene Lee
      ... Correct. However, regarding the subject, the Mac file type information is stored in the file TYPE field of the HFS+ structure, and not in the resource
      Message 2 of 5 , Jun 4, 2003
      • 0 Attachment
        On Wed, Jun 04, 2003 at 11:20:35AM -0400, Benji Fisher wrote:
        :
        : Bodhi wrote:
        : >
        : >This has nothing to do with "carbonization", rather it has a bit to do
        : >with resource forks.
        : >
        : >Unless I have missed something fairly obvious, the command line version
        : >of Vim doesn't write resource forks.

        Correct. However, regarding the subject, the Mac file type information
        is stored in the file TYPE field of the HFS+ structure, and not in the
        resource fork.

        : Perhaps the second item from the FAQ at
        :
        : http://macvim.swdev.org/OSX/#FAQ
        :
        : will help here. (I think the same advice applies for any version of
        : vim and Mac OS.)

        Sounds like a winner to me. :-)


        --
        Eugene Lee
      • Dany St-Amant
        ... This problem should not be seen on the MACOS_CLASSIC version (even the carbonized one). I created a generic function mch_copy_file_attribute() [which is
        Message 3 of 5 , Jun 4, 2003
        • 0 Attachment
          Le mercredi, 4 jun 2003, à 12:38 Canada/Eastern, Eugene Lee a écrit :

          > On Wed, Jun 04, 2003 at 11:20:35AM -0400, Benji Fisher wrote:
          > :
          > : Bodhi wrote:
          > : >
          > : >This has nothing to do with "carbonization", rather it has a bit to
          > do
          > : >with resource forks.
          > : >
          > : >Unless I have missed something fairly obvious, the command line
          > version
          > : >of Vim doesn't write resource forks.
          >
          > Correct. However, regarding the subject, the Mac file type information
          > is stored in the file TYPE field of the HFS+ structure, and not in the
          > resource fork.

          This problem should not be seen on the MACOS_CLASSIC version (even
          the carbonized one). I created a generic function
          mch_copy_file_attribute()
          [which is now also used by the Windows version] to copy the resource
          fork
          and finder attribute from the original file. In don't remember why I
          remove
          the called from the MACOS_X version, but I'll take a look at it on the
          weekend.
          As for the plain UNIX version or X (as in Motif, Athena, ...), I don't
          know if there's
          some HFS function within Darwin which can be used.

          > : Perhaps the second item from the FAQ at
          > :
          > : http://macvim.swdev.org/OSX/#FAQ
          > :
          > : will help here. (I think the same advice applies for any version of
          > : vim and Mac OS.)
          >
          > Sounds like a winner to me. :-)

          Dany
        Your message has been successfully submitted and would be delivered to recipients shortly.