diff --git a/distro/win32/_sgpem.vcproj b/distro/win32/_sgpem.vcproj
new file mode 100644
index 0000000..1d921f4
--- /dev/null
+++ b/distro/win32/_sgpem.vcproj
@@ -0,0 +1,224 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distro/win32/backend.vcproj b/distro/win32/backend.vcproj
new file mode 100644
index 0000000..58312ac
--- /dev/null
+++ b/distro/win32/backend.vcproj
@@ -0,0 +1,726 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distro/win32/config/config.h b/distro/win32/config/config.h
new file mode 100644
index 0000000..0d8c0c2
--- /dev/null
+++ b/distro/win32/config/config.h
@@ -0,0 +1,23 @@
+#ifndef SG_DLLEXPORT
+ #define SG_DLLEXPORT __declspec(dllexport)
+#endif
+
+#ifndef SG_DLLLOCAL
+ #define SG_DLLLOCAL
+#endif
+
+#ifndef PLUGDIR
+ #define PLUGDIR ".\\plugins"
+#endif
+
+#ifndef POLDIR
+ #define POLDIR ".\\policies"
+#endif
+
+#ifndef GLADEDIR
+ #define GLADEDIR ".\\glade"
+#endif
+
+#ifndef SHAREDIR
+ #define SHAREDIR ".\\plugins\\extras\\pyloader"
+#endif
\ No newline at end of file
diff --git a/distro/win32/pyloader.vcproj b/distro/win32/pyloader.vcproj
new file mode 100644
index 0000000..f13e1a4
--- /dev/null
+++ b/distro/win32/pyloader.vcproj
@@ -0,0 +1,226 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distro/win32/sgpemv2.sln b/distro/win32/sgpemv2.sln
new file mode 100644
index 0000000..8dd0fee
--- /dev/null
+++ b/distro/win32/sgpemv2.sln
@@ -0,0 +1,56 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "backend", "backend.vcproj", "{4183D2B3-B54F-4C91-AEFD-F68BB9B86C08}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyloader", "pyloader.vcproj", "{4054CAB1-7F6D-4FC7-884D-9B823F996679}"
+ ProjectSection(ProjectDependencies) = postProject
+ {4183D2B3-B54F-4C91-AEFD-F68BB9B86C08} = {4183D2B3-B54F-4C91-AEFD-F68BB9B86C08}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmlsave", "xmlsave.vcproj", "{7B477FAB-6E10-4347-9244-AC15D3A36670}"
+ ProjectSection(ProjectDependencies) = postProject
+ {4183D2B3-B54F-4C91-AEFD-F68BB9B86C08} = {4183D2B3-B54F-4C91-AEFD-F68BB9B86C08}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sgpemv2", "sgpemv2.vcproj", "{C0BAA36E-0699-4885-8123-9906CC7845E5}"
+ ProjectSection(ProjectDependencies) = postProject
+ {4183D2B3-B54F-4C91-AEFD-F68BB9B86C08} = {4183D2B3-B54F-4C91-AEFD-F68BB9B86C08}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_sgpem", "_sgpem.vcproj", "{8B810FB6-B138-45B0-AB81-228076316780}"
+ ProjectSection(ProjectDependencies) = postProject
+ {4183D2B3-B54F-4C91-AEFD-F68BB9B86C08} = {4183D2B3-B54F-4C91-AEFD-F68BB9B86C08}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4183D2B3-B54F-4C91-AEFD-F68BB9B86C08}.Debug|Win32.ActiveCfg = Release|Win32
+ {4183D2B3-B54F-4C91-AEFD-F68BB9B86C08}.Debug|Win32.Build.0 = Release|Win32
+ {4183D2B3-B54F-4C91-AEFD-F68BB9B86C08}.Release|Win32.ActiveCfg = Release|Win32
+ {4183D2B3-B54F-4C91-AEFD-F68BB9B86C08}.Release|Win32.Build.0 = Release|Win32
+ {4054CAB1-7F6D-4FC7-884D-9B823F996679}.Debug|Win32.ActiveCfg = Release|Win32
+ {4054CAB1-7F6D-4FC7-884D-9B823F996679}.Debug|Win32.Build.0 = Release|Win32
+ {4054CAB1-7F6D-4FC7-884D-9B823F996679}.Release|Win32.ActiveCfg = Release|Win32
+ {4054CAB1-7F6D-4FC7-884D-9B823F996679}.Release|Win32.Build.0 = Release|Win32
+ {7B477FAB-6E10-4347-9244-AC15D3A36670}.Debug|Win32.ActiveCfg = Release|Win32
+ {7B477FAB-6E10-4347-9244-AC15D3A36670}.Debug|Win32.Build.0 = Release|Win32
+ {7B477FAB-6E10-4347-9244-AC15D3A36670}.Release|Win32.ActiveCfg = Release|Win32
+ {7B477FAB-6E10-4347-9244-AC15D3A36670}.Release|Win32.Build.0 = Release|Win32
+ {C0BAA36E-0699-4885-8123-9906CC7845E5}.Debug|Win32.ActiveCfg = Release|Win32
+ {C0BAA36E-0699-4885-8123-9906CC7845E5}.Debug|Win32.Build.0 = Release|Win32
+ {C0BAA36E-0699-4885-8123-9906CC7845E5}.Release|Win32.ActiveCfg = Release|Win32
+ {C0BAA36E-0699-4885-8123-9906CC7845E5}.Release|Win32.Build.0 = Release|Win32
+ {8B810FB6-B138-45B0-AB81-228076316780}.Debug|Win32.ActiveCfg = Release|Win32
+ {8B810FB6-B138-45B0-AB81-228076316780}.Debug|Win32.Build.0 = Release|Win32
+ {8B810FB6-B138-45B0-AB81-228076316780}.Release|Win32.ActiveCfg = Release|Win32
+ {8B810FB6-B138-45B0-AB81-228076316780}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/distro/win32/sgpemv2.vcproj b/distro/win32/sgpemv2.vcproj
new file mode 100644
index 0000000..aa485d2
--- /dev/null
+++ b/distro/win32/sgpemv2.vcproj
@@ -0,0 +1,374 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distro/win32/xmlsave.vcproj b/distro/win32/xmlsave.vcproj
new file mode 100644
index 0000000..9e254b2
--- /dev/null
+++ b/distro/win32/xmlsave.vcproj
@@ -0,0 +1,230 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/backend/global_preferences.cc b/src/backend/global_preferences.cc
index 9367957..8a393ba 100644
--- a/src/backend/global_preferences.cc
+++ b/src/backend/global_preferences.cc
@@ -19,6 +19,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "config.h"
+#include "gettext.h"
#include
#include
@@ -30,6 +31,10 @@
// Do not include in header file:
#include
+#ifdef _MSC_VER
+ #include
+#endif
+
using namespace sgpem;
// Explicit template instantiation to allow to export symbols from the DSO.
@@ -44,6 +49,48 @@ const Glib::ustring&
GlobalPreferences::get_preferences_dir() const throw(Glib::FileError)
{
using namespace Glib;
+ // windows-specific part, i don't use ifdef WIN32 since I'm not sure how
+ // it will behave on MinGW/Cygwin...
+#ifdef _MSC_VER
+ TCHAR raw_path[MAX_PATH];
+
+ if(SUCCEEDED(SHGetFolderPath(NULL,
+ CSIDL_APPDATA,
+ NULL,
+ SHGFP_TYPE_CURRENT,
+ raw_path)))
+ {
+ // if UNICODE, characters are 16bit, otherwise plain bytes
+# ifdef UNICODE
+ std::wstring path(raw_path);
+# else
+ std::string path(raw_path);
+# endif
+
+ path += TEXT("\\sgpemv2");
+
+ // Create "Application Data\sgpemv2". if not present,
+ // otherwise it is a no-op
+ CreateDirectory(path.c_str(), NULL);
+
+ // if UNICODE, we need to convert to utf-8
+ // I'm not sure if this part is OK, anyway...
+# ifdef UNICODE
+ char raw_path_utf[MAX_PATH];
+
+ WideCharToMultiByte(CP_UTF8, 0, path.c_str(), -1, raw_path_utf, MAX_PATH, NULL, NULL);
+
+ return Glib::ustring(raw_path_utf);
+# else
+ // no UNICODE, simply return plain string
+ return path;
+# endif //~UNICODE
+ }
+ else
+ throw FileError(FileError::FAILED, _("Unable to obtain Application Data directory"));
+
+#else
+
static const ustring dir = get_home_dir() + G_DIR_SEPARATOR_S + ".sgpemv2";
if(!file_test(dir, FILE_TEST_IS_DIR))
{
@@ -52,6 +99,8 @@ GlobalPreferences::get_preferences_dir() const throw(Glib::FileError)
throw FileError(FileError::FAILED, g_strerror(err));
}
return dir;
+
+#endif //~_MSC_VER
}