Page MenuHomePhabricator

[Support] Add sys::fs::set_current_path() (aka chdir)
ClosedPublic

Authored by labath on Jan 23 2017, 9:07 AM.

Details

Summary

This adds a cross-platform way of setting the current working directory
analogous to the existing current_path() function used for retrieving
it. The function will be used in lldb.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Jan 23 2017, 9:07 AM

Windows code looks fine to me.

silvas edited edge metadata.Jan 23 2017, 11:28 PM

We have a chdir in lib/Basic/VirtualFileSystem.cpp that probably can be moved to using this API in a followup patch.

We have a chdir in lib/Basic/VirtualFileSystem.cpp that probably can be moved to using this API in a followup patch.

that is clang/lib/Basic/VirtualFileSystem.cpp

Thanks for the review. Main two usages for chdir are:

  • launching the debugged process in a given directory
  • we have a remote stub, which (besides doing remote debugging) can execute user-supplied shell commands on the target device. These commands need a CWD.

I'll create a follow-up clang patch after this.

This revision was automatically updated to reflect the committed changes.