NSFileSystemFileNumber is changed after file is ed

2019-09-11 01:43发布

问题:

I am working on File Management System exactly like Dropbox in Cocoa.

My problem is when i edit any text file at that time NSFileSystemFileNumber is changed.

I want an unique NSFileSystemFileNumber even if that edited file is moved from the particular folder.

In short, I just want to know how to fetch that moved file's old or original path from the database.

Any alternate way to solve out this problem?

Thanks in Adv..!!

回答1:

It depends on how the editor save functionality is implemented. Each editor will have different functionality and it sounds like the one you are using does the following:

  1. Delete existing file.
  2. Create new file.
  3. Write file data.

Hence you get a new inode each time. Others might:

  1. Truncate existing file.
  2. Write file data.

which would result in the same inode each time.

There is nothing you can about this so you will need to track file changes using the name or something, not the inode.