Quote:
Originally Posted by
emitrax
The best way is probably to iterate and call mkdir and chdir every time.
I'm actually in the process of doing something similar, and that's the way I'll go.
Constructing the (full) path every time is quite annoying, while changing the working
directory should be more easy.
S.
That solution introduces an effect that impacts the entire process it's running in: the changing of the current directory.
If you do something like that you will then have what's almost certainly an undocumented and definitely an unnecessary dependency on the internal implementation of what should in theory be reusable code. Unless you fully document all the internals of such calls, then you'll only have an unnecessary dependency.
And you'll outright break multithreaded apps because threads other than the one calling a mkdir() call that changes the current directory will have the current directory modified right out from under their processing.