diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-09-19 21:12:45 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-09-19 21:12:45 -0300 |
commit | b76d50299a7995b2b3be0a3f9bf954cceeb89314 (patch) | |
tree | 5e234bb5216325882610e028826256617b44c2f8 /Project/main.cpp | |
parent | de90dfcf76c1fb13648633b6bddb011b15ac8458 (diff) | |
download | PSP.git-b76d50299a7995b2b3be0a3f9bf954cceeb89314.tar.gz PSP.git-b76d50299a7995b2b3be0a3f9bf954cceeb89314.tar.xz PSP.git-b76d50299a7995b2b3be0a3f9bf954cceeb89314.zip |
Open file .psp implemented
Several directories bugfixes
Diffstat (limited to 'Project/main.cpp')
-rw-r--r-- | Project/main.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Project/main.cpp b/Project/main.cpp index a138a63..de8cac3 100644 --- a/Project/main.cpp +++ b/Project/main.cpp @@ -3,6 +3,7 @@ #include <wx/image.h> #include <wx/stdpaths.h> #include <wx/textfile.h> +#include <wx/cmdline.h> #include "MainFrame.h" #include "PropertiesData.h" @@ -15,12 +16,13 @@ class MainApp : public wxApp virtual ~MainApp() {} bool LoadInitFile(PropertiesData* propertiesData) { - wxTextFile file("config.ini"); + wxFileName fn(wxStandardPaths::Get().GetExecutablePath()); + wxTextFile file(fn.GetPath() + "\\config.ini"); auto data = propertiesData->GetGeneralPropertiesData(); if(!file.Create()) { if(!file.Open()) return false; - + wxString line; for(line = file.GetFirstLine(); !file.Eof(); line = file.GetNextLine()) { wxString tag = ""; @@ -53,7 +55,7 @@ class MainApp : public wxApp } } file.Close(); - } else { // Create default init file. + } else { // Create default init file. if(!file.Open()) return false; // Default parameters. @@ -95,7 +97,19 @@ class MainApp : public wxApp wxLocale* locale = new wxLocale(); LoadCatalogs(locale, propertiesData); - MainFrame* mainFrame = new MainFrame(NULL, locale, propertiesData); + wxString openFilePath = ""; + + wxCmdLineParser cmdLineParser(wxApp::argc, wxApp::argv); + cmdLineParser.AddParam("", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL); + if(cmdLineParser.Parse() == 0) { + wxCmdLineArgs args = cmdLineParser.GetArguments(); + for(auto it = args.begin(), itEnd = args.end(); it != itEnd; ++it) { + if(it->GetKind() == wxCMD_LINE_PARAM) { + openFilePath = it->GetStrVal(); + } + } + } + MainFrame* mainFrame = new MainFrame(NULL, locale, propertiesData, openFilePath); mainFrame->SetIcon(wxICON(aaaaprogicon)); SetTopWindow(mainFrame); return GetTopWindow()->Show(); |