[file path split-path] Naming "first split-path"
[1/3] from: gregg:pointillistic at: 11-Oct-2010 14:29
After years of using "first split-path file" directly, I'm considering a shortcut mezzanine. e.g. path-of: func [file [file! url!]] [ first split-path file ] A common use for this is with MAKE-DIR, which I also have a wrapper for (ENSURE-DIR-EXISTS), when writing files. It's a longer name, but says what I want. The question is what to call it. Do you think PATH-OF is good, like WORDS-OF and other *-OF reflective funcs, or should it be PATH-TO? Any other name suggestions? make-dir/deep first split-path file versus ensure-dir-exists path-of file or ensure-dir-exists path-to file We could also look at whether ENSURE-DIR-EXISTS should just take the file and split the path for it internally, but I don't like that idea as I think it assumes too much. --Gregg
[2/3] from: carl:cybercraft at: 12-Oct-2010 2:12
Hi Gregg, If you're doing this, won't you also want a function to get the file part too? If so, the 'of' seems better than 'to', it being usable for both... path-of file file-of file (or perhaps name-of) This would also be useful... ext-of file -- Carl Read. On Monday, 11-October-2010 at 14:29:20 Gregg Irwin wrote,
[3/3] from: gregg:pointillistic at: 12-Oct-2010 16:18
CR> If you're doing this, won't you also want a function to get the CR> file part too? If so, the 'of' seems better than 'to', it being CR> usable for both... CR> path-of file CR> file-of file (or perhaps name-of) CR> This would also be useful... CR> ext-of file Great point Carl. I use SUFFIX? quite a lot, which took getting used to, as it is less programmerish than "extension". I would say type-of might be a four-letter option to match the length of 'path and 'file, but MIME types are probably a better match for that. Hmmm, I wonder if there's a good way to name things that normalizes file! and url! terminology (drive/path/name/extension, host/path/target)? -- Gregg