diff options
author | marha <marha@users.sourceforge.net> | 2011-01-27 13:44:12 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-01-27 13:44:12 +0000 |
commit | 11903063211dc368d03f52e090e52ab18ebe3f47 (patch) | |
tree | 71991c8ffd98ed31690190b37f39cfc6244b6595 /tools/mhmake/src/build.cpp | |
parent | 59e0042680b01d7e3cf69104921f151ceee13df4 (diff) | |
download | vcxsrv-11903063211dc368d03f52e090e52ab18ebe3f47.tar.gz vcxsrv-11903063211dc368d03f52e090e52ab18ebe3f47.tar.bz2 vcxsrv-11903063211dc368d03f52e090e52ab18ebe3f47.zip |
Implemented mkdir as an internal command
Diffstat (limited to 'tools/mhmake/src/build.cpp')
-rw-r--r-- | tools/mhmake/src/build.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/tools/mhmake/src/build.cpp b/tools/mhmake/src/build.cpp index d1c4a32d1..36fdefb3d 100644 --- a/tools/mhmake/src/build.cpp +++ b/tools/mhmake/src/build.cpp @@ -357,7 +357,7 @@ exit: Error = false;
goto exit;
}
- if (-1==mkdir(pNewDest->GetFullFileName().c_str(),0777))
+ if (-1==mkdir(pNewDest->GetFullFileName().c_str(),S_IRWXU))
{
cerr << "Error creating directory " << pNewDest->GetQuotedFullFileName() << endl;
Error = false;
@@ -383,6 +383,23 @@ exit: }
/*****************************************************************************/
+mh_pid_t mhmakefileparser::MakeDirsCommand(const string &Params) const
+{
+ vector<fileinfo*> Dirs;
+
+ SplitToItems(Params,Dirs);
+
+ size_t NrDirs=Dirs.size();
+ for (size_t i=0; i<NrDirs; i++)
+ {
+ fileinfo* pDir=Dirs[i];
+ if (!MakeDirs(pDir))
+ return (mh_pid_t)-1;
+ }
+ return (mh_pid_t)0;
+}
+
+/*****************************************************************************/
mh_pid_t mhmakefileparser::EchoCommand(const string &Params) const
{
// Find the first > character
@@ -440,7 +457,7 @@ mh_pid_t mhmakefileparser::CopyFiles(const string &Params) const if (NrSrcs<1)
{
cerr << "Wrong number of arguments in copy: "<<Params<<endl;
- return false;
+ return (mh_pid_t)-1;
}
fileinfo* pDest=Files[NrSrcs];
@@ -1166,7 +1183,7 @@ mh_pid_t mhmakefileparser::ExecuteCommand(string Command, bool &IgnoreError, str }
if (i==Params.size())
{
- if (Command!="del" && Command!="touch" && Command!="copy" && Command!="echo")
+ if (Command!="del" && Command!="touch" && Command!="copy" && Command!="echo" && Command!="mkdir")
Command=GetFullCommand(Command);
#ifndef WIN32
if (Command.substr(0,GetComspec().size())==GetComspec())
@@ -1226,6 +1243,10 @@ mh_pid_t mhmakefileparser::ExecuteCommand(string Command, bool &IgnoreError, str {
return EchoCommand(Params);
}
+ else if (Command=="mkdir")
+ {
+ return MakeDirsCommand(Params);
+ }
return OsExeCommand(Command,Params,IgnoreError,pOutput);
#ifdef _DEBUG
|