From: Stephan S. <gma...@sp...> - 2013-11-07 05:06:30
|
Couldn't you store that setting in POSIX user-namespaced extended attributes and fall back to .directory if the admin disabled them or the filesystem doesn't support them? https://en.wikipedia.org/wiki/Extended_file_attributes#Linux That's sort of the whole point of allowing custom key=value metadata outside the actual file/directory contents. Plus, it would allow CD/DVD burning tools to automatically know it ignore them while giving utilities like cp/mv/rsync/etc. a hint as to when they should be preserved and what they're associated with. (At the moment, cp and rsync don't preserve them unless you use `-p all` and -X, respectively, but the hint is there.) It would also follow a pattern similar to how MacOS uses resource forks. Here are the freedesktop.org guidelines: http://www.freedesktop.org/wiki/CommonExtendedAttributes/ On 13-11-06 09:48 PM, Andrej N. Gritsenko wrote: > Hello! > > I'm currently working on implementation of next feature for PCManFM. > It is different sort and view mode for selected folders. I.e. user can > check an option 'Use these settings for this folder only' and sort (and > view mode) will be remembered for current folder independently from > common settings. The question is how to do that. I know two ways now: > > 1. Use '.directory' file in folder in question. > Pros: > - can be used by other implementations and other file managers; > - settings persist if folder is renamed; > - settings persist if folder is accessed other way (via ssh, ftp, etc.). > Cons: > - can be used only if user can write into .directory file in folder. > > 2. Use cache file somewhere. > Pros: > - can be used against system directories (/usr for example). > Cons: > - completely implementation-dependent and even environment-dependent; > - settings are lost when folder is renamed; > - it may be impossible to have different settings for removable media; > - cache will grow indefinitely, no sane cleaning heuristics exist. > > I would appreciate all your opinions and I'm waiting for them until I > start implementing it. Thank you in advance. > > Cheers! > Andriy. > > ------------------------------------------------------------------------------ > November Webinars for C, C++, Fortran Developers > Accelerate application performance with scalable programming models. Explore > techniques for threading, error checking, porting, and tuning. Get the most > from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk > |