#MakePath

1 messages · Page 1 of 1 (latest)

proven needle
#

If you are fine with cwd, you can use std.fs.cwd().makePath("foobar")

#

you might want makeOpenPath if you want the handle to it immediately as well

rugged bolt
proven needle
#

std.fs.cwd().makePath() will work with both relative and absolute paths

#

so even if you give it like C:/foobar it will work

rugged bolt
#

but cwd() means current working directory?

proven needle
#

yeah but it still works with absolute paths as well

rugged bolt
proven needle
#

you could also use std.posix.mkdir but both work anyways

rugged bolt
#

I didnt find anything in std, is there a function to extract from a path string the filename?

#

does linux not make this difficult since files can oftentimes have no file extension?

#

seems like a big os design flaw to me

patent hemlock
#

*nix extensively uses file signatures -- the first few bytes in the file (e.g. shebang). Mac OS used to rely on the data fork of a file. File extensions are too constrained a namespace for many purposes. All choices have tradeoffs.

rugged bolt
#

seems like a big tradeoff to me, cant easily judge from a pathname alone if its just a path or path+file

patent hemlock
#

You still can't even with extensions. On Windows, there's nothing that prevents a folder from having an extension.