summaryrefslogtreecommitdiff
path: root/TestDir/makedir.cpp
diff options
context:
space:
mode:
authorAlessio Treglia <quadrispro@ubuntu.com>2010-05-02 01:23:55 +0200
committerAlessio Treglia <quadrispro@ubuntu.com>2010-05-02 01:23:55 +0200
commitcb40adc8ca28f1f951fa1ef458015e3174a8eb1b (patch)
tree78c3e41484641f6965c72dfd543dca3b13d4d234 /TestDir/makedir.cpp
parent75096346270d50c7b541003e8bd836eb9da82d2e (diff)
Merge with upstream-new.
Diffstat (limited to 'TestDir/makedir.cpp')
-rw-r--r--TestDir/makedir.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/TestDir/makedir.cpp b/TestDir/makedir.cpp
new file mode 100644
index 00000000..a7b31596
--- /dev/null
+++ b/TestDir/makedir.cpp
@@ -0,0 +1,45 @@
+#include <wx/log.h>
+#include <wx/tokenzr.h>
+#include <wx/arrstr.h>
+#include "wx/filefn.h"
+#include "wx/dir.h"
+#include <wx/init.h> //wxInitializer
+#include <wx/string.h> //wxString
+#include "wx/cmdline.h"
+
+static const wxCmdLineEntryDesc cmdLineDesc[] =
+{
+ {wxCMD_LINE_PARAM, NULL, NULL, wxT("input file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE },
+ {wxCMD_LINE_NONE }
+};
+
+
+int main(int argc, char **argv)
+{
+ //Initialize the wxWidgets library
+ wxInitializer initializer;
+ wxLog::EnableLogging(false);
+
+ //parse the input
+ wxCmdLineParser parser;
+ parser.SetDesc(cmdLineDesc);
+ parser.SetCmdLine(argc, argv);
+ if (parser.Parse() != 0) {
+ return -1;
+ }
+
+ for (size_t i=0; i< parser.GetParamCount(); i++) {
+ wxString argument = parser.GetParam(i);
+ if( !wxDir::Exists(argument) ){
+ argument.Replace(wxT("\\"), wxT("/"));
+ wxArrayString arr = wxStringTokenize(argument, wxT("/"), wxTOKEN_STRTOK);
+ wxString path;
+ for(size_t i=0; i<arr.GetCount(); i++){
+ path << arr.Item(i) << wxT("/");
+ wxMkdir(path, 0777);
+ }
+ }
+ }
+
+ return 0;
+}