[Lldb-commits] [PATCH] Replace 'mkdir' shell invocation by native function call.
Jean-Daniel Dupas
devlists at shadowlab.org
Fri Dec 6 15:51:41 PST 2013
Now that Host provide a MakeDirectory function, we can use it instead of relying on command line tool to create a directory.
http://llvm-reviews.chandlerc.com/D2356
Files:
source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
Index: source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
===================================================================
--- source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -273,14 +273,7 @@
MakeCacheFolderForFile (const FileSpec& module_cache_spec)
{
FileSpec module_cache_folder = module_cache_spec.CopyByRemovingLastPathComponent();
- StreamString mkdir_folder_cmd;
- mkdir_folder_cmd.Printf("mkdir -p %s/%s", module_cache_folder.GetDirectory().AsCString(), module_cache_folder.GetFilename().AsCString());
- return Host::RunShellCommand(mkdir_folder_cmd.GetData(),
- NULL,
- NULL,
- NULL,
- NULL,
- 60);
+ return Host::MakeDirectory(module_cache_folder.GetPath().c_str(), 0700);
}
static lldb_private::Error
Index: source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
===================================================================
--- source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -288,16 +288,8 @@
}
// bring in the remote module file
FileSpec module_cache_folder = module_cache_spec.CopyByRemovingLastPathComponent();
- StreamString mkdir_folder_cmd;
// try to make the local directory first
- mkdir_folder_cmd.Printf("mkdir -p %s/%s", module_cache_folder.GetDirectory().AsCString(), module_cache_folder.GetFilename().AsCString());
- Host::RunShellCommand(mkdir_folder_cmd.GetData(),
- NULL,
- NULL,
- NULL,
- NULL,
- 60);
- Error err = GetFile(platform_file, module_cache_spec);
+ Error err = Host::MakeDirectory(module_cache_folder.GetPath().c_str(), 0700);
if (err.Fail())
return err;
if (module_cache_spec.Exists())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2356.1.patch
Type: text/x-patch
Size: 2114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20131206/36568e98/attachment.bin>
More information about the lldb-commits
mailing list