Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

But sometimes you want to just "open" a file. The fact that your computer may choose to save it is an implementation detail. In fact, most systems don't actually 'save' it in many senses of the word. Instead they write it to the file system in a way that indicates that it may be removed at any time without notifying the user. In fact, on Linux (I can't speak to any other OS), it is common for these temporary files never to actually be saved to the disk. Instead they are loaded into a RAM based file-system (tmpfs), usually found at "/dev/shm"


In a way, that's worse! You'll have someone "open" a file, maybe make some edits to it, save it -- and it won't indicate a problem with that because it's considered as a file on disk somewhere -- and then when they go to send it, they can't find it and it may have been overwritten / deleted.


If the file is opened read-only, then programs should fall back to save as. Unfourtuantly, the only standard way to signal read-only is with file permisions. This will work, but many programs would likely have report a permisions error prior to the save as. Also it will cause problems for programs that transparently modify the file on disk while viewing. I suppose you could hard code the read only parameter into the command that is used to execute the external program. Or have the external programs check if they are in a tmp-directory.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: