Closed alexdantas closed 10 years ago
Is it really necessary to create a full clib for a single function? We should fit all file-related functions here - including mkdir(), is_directory(), is_file() and ls().
I've developed those last ones in C++, shouldn't be hard to port them back.
What's keeping us from inserting mkdir_p()
here?
The function style? I've already changed it originally - perhaps a tip on specifics could help.
It's name? Can't think of something nice. file_create_dir
doesn't imply recursiveness.
Come on, 4 days without comments? I'm merging this tomorrow
I don't think this addition is all that useful, but I'm not using this lib so maybe I'm wrong.
This doesn't seem to work anymore:
stephen@sm:~/file-1$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://github.com/alexdantas/file-1.git
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "mkdir-p"]
remote = origin
merge = refs/heads/mkdir-p
stephen@sm:~/file-1$ make
cc -std=c99 example.c src/file.c -o example
example.c: In function ‘main’:
example.c:16:3: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘off_t’ [-Wformat]
stephen@sm:~/file-1$ ./example test
exists: no
size: -1
Segmentation fault (core dumped)
stephen@sm:~/file-1$
You can avoid the warning with #define _BSD_SOURCE
, or use a separate lib to copy strings. clib(1) uses strdup
all over the place, so I wouldn't worry too much about it.
Thanks for the updates, this now LGTM.
Wow, that took a while Thanks, @stephenmathieson
Don't know if this would fit here, nor if this is the best function name.
Either way, it's a nice addition to the package.