NSFileSystemFileNumber is changed after file is edited/updated in objective c

廉价感情. 提交于 2019-12-24 21:45:51

问题


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.



来源:https://stackoverflow.com/questions/30187163/nsfilesystemfilenumber-is-changed-after-file-is-edited-updated-in-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!