From 669b99d1449d13f55ea92d174b158f5e416e7839 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 26 Oct 2015 23:51:18 +0000 Subject: [PATCH] Fixed new account creation for Win32 using GetUserPrefDir and GetUserDir properly. --- source/frmNewAccount.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/source/frmNewAccount.cpp b/source/frmNewAccount.cpp index 55acf26..a28eefd 100644 --- a/source/frmNewAccount.cpp +++ b/source/frmNewAccount.cpp @@ -338,6 +338,7 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) // Finished. wxString XestiaABPrefDirectory; + wxString XestiaABDirectory; wxString AccountSettingsFile; //wxFile ASFile; wxString RandomNumberSuffix = wxString::Format(wxT("%i"), rand() % 32767); @@ -350,7 +351,8 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) #elif defined(__WIN32__) XestiaABPrefDirectory = GetUserPrefDir(); - + XestiaABDirectory = GetUserDir(); + AccountSettingsFile = XestiaABPrefDirectory + wxT("accounts"); // Open the file for writing. @@ -385,7 +387,7 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) wxString DirectoryName = txtAccountName->GetValue().Mid(0, 30) + RandomNumberSuffix; - if (wxMkdir(XestiaABPrefDirectory + wxT("/accounts/") + DirectoryName + wxT(".carddav"), 0740) == TRUE){ + if (wxMkdir(XestiaABDirectory + wxT("\\accounts\\") + DirectoryName + wxT(".carddav"), 0740) == TRUE){ DirectoryCreated = TRUE; @@ -408,7 +410,7 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) wxString DirectoryName = txtAccountName->GetValue().Mid(0, 30) + RandomNumberSuffix; - if (wxMkdir(XestiaABPrefDirectory + wxT("/accounts/") + DirectoryName + wxT(".local"), 0740) == TRUE){ + if (wxMkdir(XestiaABDirectory + wxT("\\accounts\\") + DirectoryName + wxT(".local"), 0740) == TRUE){ DirectoryCreated = TRUE; @@ -434,9 +436,10 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) #else - XestiaABPrefDirectory = GetUserDir(); + XestiaABPrefDirectory = GetUserPrefDir(); + XestiaABDirectory = GetUserDir(); - AccountSettingsFile = GetUserPrefDir() + wxT("accounts"); + AccountSettingsFile = XestiaABPrefDirectory + wxT("accounts"); // Open the file for writing. @@ -470,7 +473,7 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) wxString DirectoryName = txtAccountName->GetValue().Mid(0, 30) + RandomNumberSuffix; - if (wxMkdir(XestiaABPrefDirectory + wxT("/accounts/") + DirectoryName + wxT(".carddav"), 0740) == TRUE){ + if (wxMkdir(XestiaABDirectory + wxT("/accounts/") + DirectoryName + wxT(".carddav"), 0740) == TRUE){ DirectoryCreated = TRUE; @@ -493,7 +496,7 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) wxString DirectoryName = txtAccountName->GetValue().Mid(0, 30) + RandomNumberSuffix; - if (wxMkdir(XestiaABPrefDirectory + wxT("/accounts/") + DirectoryName + wxT(".local"), 0740) == TRUE){ + if (wxMkdir(XestiaABDirectory + wxT("/accounts/") + DirectoryName + wxT(".local"), 0740) == TRUE){ DirectoryCreated = TRUE; -- 2.39.5