<AdditionalIncludeDirectories>.\..\..\lib\vc_x64_lib\mswud;.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
- <AdditionalDependencies>wxmsw30ud_core.lib;wxbase30ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>wxmsw30ud_core.lib;wxbase30ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;Shlwapi.dll;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>vc_mswud_x64\minimal.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>.\..\..\lib\vc_x64_lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalIncludeDirectories>.\..\..\lib\vc_x64_dll\mswu;.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
- <AdditionalDependencies>wxmsw30u_core.lib;wxbase30u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>wxmsw30u_core.lib;wxbase30u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;Shlwapi.dll;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>vc_mswu_x64\minimal.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>K:\LibraryBuild\Win7\lib\vc_x64_dll;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalIncludeDirectories>.\..\..\lib\vc_x64_dll\mswud;.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
- <AdditionalDependencies>wxmsw30ud_core.lib;wxmsw30ud_html.lib;wxbase30ud.lib;wxmsw30ud_adv.lib;sqlite3.lib;libcurl.lib;libxml2.dll.a;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;security.lib;cryptui.lib;crypt32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>wxmsw30ud_core.lib;wxmsw30ud_html.lib;wxbase30ud.lib;wxmsw30ud_adv.lib;sqlite3.lib;libcurl.lib;libxml2.dll.a;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;security.lib;cryptui.lib;crypt32.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>vc_mswuddll_x64\xestiacal.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(SQLITE_64BIT);$(SFML_64BIT)\lib;$(LIBXML2_64BIT)\lib;$(CURL_64BIT)\builds\\libcurl-vc-x64-release-dll-zlib-dll-ipv6-sspi-winssl\lib;$(WXWIDGETS_64BIT_DEBUG)\lib\vc_x64_dll;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalIncludeDirectories>.\..\..\lib\vc_x64_dll\mswu;.\..\..\include;.;.\..\..\samples;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
- <AdditionalDependencies>wxmsw30u_core.lib;wxmsw30u_html.lib;wxbase30u.lib;wxmsw30u_adv.lib;sqlite3.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>wxmsw30u_core.lib;wxmsw30u_html.lib;wxbase30u.lib;wxmsw30u_adv.lib;sqlite3.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>vc_mswudll_x64\xestiacal.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(SQLITE_64BIT);$(SFML_64BIT)\lib;$(LIBXML2_64BIT)\lib;$(CURL_64BIT)\builds\libcurl-vc-x64-release-dll-zlib-static-ipv6-sspi-winssl\lib;$(WXWIDGETS_64BIT)\lib\vc_x64_dll;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
bool FileExists(std::string filename){
-#if defined (__WIN32__)
+#if defined (WIN32)
#else
return true;
+}
+
+bool FileExists(std::wstring filename) {
+
+#if defined (WIN32)
+
+ return PathFileExists(filename.c_str());
+
+#else
+
+ struct stat bufferData;
+
+ if (stat(filename.c_str(), &bufferData) == -1) {
+ return false;
+ }
+
+#endif
+
+ return true;
+
}
\ No newline at end of file
#include <string>
#include <iostream>
-#if defined (__WIN32__)
-
+#if defined (WIN32)
+#include <windows.h>
+#include <Shlwapi.h>
#else
#include <sys/stat.h>
#endif
bool FileExists(std::string filename);
+bool FileExists(std::wstring filename);
#endif
\ No newline at end of file
// Build the path.
- string calendarListFilename = string(GetUserDir().mb_str());
+ string calendarListFilename = string(GetUserDir().ToUTF8());
calendarListFilename += "accounts/";
- calendarListFilename += string(preferences->accounts.GetAccountDirectory(accountSeek).mb_str());
+ calendarListFilename += string(preferences->accounts.GetAccountDirectory(accountSeek).ToUTF8());
calendarListFilename += ".";
- calendarListFilename += string(preferences->accounts.GetAccountType(accountSeek).mb_str());
+ calendarListFilename += string(preferences->accounts.GetAccountType(accountSeek).ToUTF8());
// Get the list of calendars.
// Set the calendar ID.
- CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(string(preferences->accounts.GetAccountName(accountSeek).mb_str()), calendarList.calendarShortName[calendarSeek]);
+ CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(string(preferences->accounts.GetAccountName(accountSeek).ToUTF8()), calendarList.calendarShortName[calendarSeek]);
calendarList.calendarStorageID[calendarSeek] = calendarInfo.calendarID;
// Find the entries and load each entry.
accountDirectoryPath += "accounts/";
accountDirectoryPath += string(preferences->accounts.GetAccountDirectory(calendarInfo->accountPreferencesID).ToUTF8());
accountDirectoryPath += ".";
- accountDirectoryPath += string(preferences->accounts.GetAccountType(calendarInfo->accountPreferencesID).mb_str());
+ accountDirectoryPath += string(preferences->accounts.GetAccountType(calendarInfo->accountPreferencesID).ToUTF8());
accountDirectoryPath += "/";
// Generate a UUID for the new calendar.
if (!accountDirFull.IsEmpty()){
- accountDirDelFull.Append(wxString::FromUTF8(getenv("HOME")));
- accountDirDelFull.Append(wxT("/.xestiacal/accounts/"));
- accountDirDelFull.Append(accountDirFull);
+ accountDirDelFull.Append(GetAccountDir(accountDirFull, false));
DeleteDirectory(accountDirDelFull);
// Load the event file.
- CalendarEventObject eventData;
+ CalendarEventObject eventData;
CalendarObjectLoadResult eventLoadResult = eventData.LoadFile(filename);
-
+
// Check the result of the event file load.
switch (eventLoadResult){
#include "../../common/colour.h"
#include "../../common/random.h"
+#if defined(WIN32)
+#include <Windows.h>
+#endif
+
enum CDSAccountResult{
CDSACCOUNT_UNITTESTFAIL = -1,
CDSACCOUNT_OK,
calendarListFile->SetPath(accountName);
- calendarShortName.push_back(string(accountName.mb_str()));
+ calendarShortName.push_back(string(accountName.ToUTF8()));
calendarListFile->Read(wxT("name"), &valueData);
- calendarName.push_back(string(valueData.mb_str()));
+ calendarName.push_back(string(valueData.ToUTF8()));
calendarListFile->Read(wxT("description"), &valueData);
- calendarDescription.push_back(string(valueData.mb_str()));
+ calendarDescription.push_back(string(valueData.ToUTF8()));
calendarListFile->Read(wxT("colour"), &valueData);
colourData = string(valueData.mb_str());
// Open the file.
+#ifndef WIN32
+
fileStream.open(saveFilename, ofstream::out);
+
+#else
+
+ wstring saveFilename_utf16;
+
+ int len = MultiByteToWideChar(CP_UTF8, 0, &saveFilename[0], (int)saveFilename.size(), NULL, 0);
+
+ if (len > 0)
+ {
+ saveFilename_utf16.resize(len);
+ MultiByteToWideChar(CP_UTF8, 0, &saveFilename[0], (int)saveFilename.size(), &saveFilename_utf16[0], len);
+ }
+
+ fileStream.open(saveFilename_utf16, ofstream::out);
+
+#endif
if (fileStream.rdstate() & ofstream::failbit){
return CALENDAROBJECTSAVE_CANNOTOPEN;
saveResult = SaveString(&saveStringData);
- fileStream.write(saveStringData.c_str(), saveStringData.size());
+ //fileStream.write(saveStringData.c_str(), saveStringData.size());
+ fileStream << saveStringData.c_str();
+
fileStream.close();
return saveResult;
// Check if the file exists and return
// CALENDAROBJECTLOAD_CANNOTOPEN if not.
- if (!FileExists(loadFilename)){
- return CALENDAROBJECTLOAD_MISSING;
- }
-
ifstream fileStream;
string receivedStringData = "";
+#ifndef WIN32
+
+ if (!FileExists(loadFilename)) {
+ return CALENDAROBJECTLOAD_MISSING;
+ }
+
fileStream.open(loadFilename, ifstream::in);
-
+
+#else
+
+ wstring loadFilename_utf16;
+
+ int len = MultiByteToWideChar(CP_UTF8, 0, &loadFilename[0], (int)loadFilename.size(), NULL, 0);
+
+ if (len > 0)
+ {
+ loadFilename_utf16.resize(len);
+ MultiByteToWideChar(CP_UTF8, 0, &loadFilename[0], (int)loadFilename.size(), &loadFilename_utf16[0], len);
+ }
+
+ if (!FileExists(loadFilename_utf16)) {
+ return CALENDAROBJECTLOAD_MISSING;
+ }
+
+ fileStream.open(loadFilename_utf16, ifstream::in);
+
+#endif
+
if (fileStream.rdstate() & ifstream::failbit){
return CALENDAROBJECTLOAD_CANNOTOPEN;
}
#include "../../common/text.h"
#include "../../version.h"
+#if defined(WIN32)
+#include <Windows.h>
+#endif
+
using namespace std;
enum CalendarObjectLoadResult {
this->Refresh();
mainPanel->Layout();
- eventListFrame->Layout();
eventListFrameSizer->Layout();
for (auto deleteIter : deleteEntriesList){