在OS X上,有一个API可以为磁盘上的给定文件创建“书签”,即使它被移动或重命名也会跟踪其目标。然后,OS X应用程序可以序列化书签,通过它想要的任何方式存储它,并在稍后的日期 - 也许在退出并重新启动后 - 反序列化书签并从中解析文件路径。
Linux有什么可比性吗?
答案 0 :(得分:0)
http://en.wikipedia.org/wiki/Inotify
我想inotify就是你想要的。 使用inotify,您可以监视文件的以下事件:
IN_ACCESS - read of the file
IN_MODIFY - last modification
IN_ATTRIB - attributes of file change
IN_OPEN - open of file
IN_CLOSE_WRITE - sent when a file opened for writing is closed
IN_CLOSE_NOWRITE - sent when a file opened not for writing is closed
IN_MOVED_FROM and IN_MOVED_TO - when the file is moved or renamed
IN_DELETE - a file/directory deleted
IN_CREATE - a file in a watched directory is created
IN_DELETE_SELF - file monitored is deleted