[Lldb-commits] [lldb] r196801 - Replace 'mkdir' shell invocation by native function call.
Jean-Daniel Dupas
devlists at shadowlab.org
Mon Dec 9 11:16:14 PST 2013
Author: jddupas
Date: Mon Dec 9 13:16:14 2013
New Revision: 196801
URL: http://llvm.org/viewvc/llvm-project?rev=196801&view=rev
Log:
Replace 'mkdir' shell invocation by native function call.
Summary: Now that Host provide a MakeDirectory function, we can use it instead of relying on command line tool to create a directory.
CC: lldb-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2356
Modified:
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=196801&r1=196800&r2=196801&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Mon Dec 9 13:16:14 2013
@@ -273,14 +273,7 @@ static lldb_private::Error
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(), eFilePermissionsDirectoryDefault);
}
static lldb_private::Error
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=196801&r1=196800&r2=196801&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Mon Dec 9 13:16:14 2013
@@ -288,16 +288,11 @@ PlatformMacOSX::GetFile (const lldb_priv
}
// 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(), eFilePermissionsDirectoryDefault);
+ if (err.Fail())
+ return err;
+ err = GetFile(platform_file, module_cache_spec);
if (err.Fail())
return err;
if (module_cache_spec.Exists())
More information about the lldb-commits
mailing list