scoped chdir and similar patterns

Timothee Cour thelastmammoth at gmail.com
Wed Dec 4 17:07:03 PST 2013


A1.

Is there a (clever?) way to achieve the following using a single function
call?

//does chdir

void fun(){
...
  string dir0=getcwd;  scope(exit) chdir(dir0);  chdir(dir);
...
}

//desired:
void fun(){
...
  chdir_scoped(dir);
...
}

AST macros should make that easy, but that's not for tomorrow apparently...

A2.
Likewise with temp file creation and similar patterns.

A3.
can we support an optional dir argument in the std.process functions to
execute inside a given directory dir (I believe the exec family should
support this)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20131204/1a1a74c5/attachment.html>


More information about the Digitalmars-d-learn mailing list