commit 63627d7a
Added quick test script to compile both C++03, C++11 and Windows. Windows now always uses ANSI strings for portability.
Updated README to reflect this.
Changed files
| M | Makefile before |
| M | README.md before |
| A | compile_test.sh |
| M | sago/platform_folders.cpp before |
diff --git a/Makefile b/Makefile
index a9e5414..75eafc0 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ O_FILES=${PROGRAMNAME}.o sago/platform_folders.o
total: ${PROGRAMNAME}.out
clean:
- rm -f */*.o *.o *.P */*.P ${PROGRAMNAME}
+ rm -f */*.o *.o *.P */*.P ${PROGRAMNAME}.out
${PROGRAMNAME}.out: $(O_FILES)
$(CXX) -O -o ${PROGRAMNAME}.out $(O_FILES) $(BASE_LIBS)
diff --git a/README.md b/README.md
index 8aed8ad..812bc1a 100644
--- a/README.md
+++ b/README.md
@@ -63,5 +63,24 @@ Download: /home/poul/Hentede filer
Save Games 1: /home/poul/.local/share
```
+On Windows it could be:
+```
+Config: C:\users\poul\Application Data
+Data: C:\users\poul\Application Data
+Cache: C:\users\poul\Local Settings\Application Data
+Documents: C:\users\poul\Mine dokumenter
+Desktop: C:\users\poul\Skrivebord
+Pictures: C:\users\poul\Mine Billeder
+Music: C:\users\poul\Min Musik
+Video: C:\users\poul\Mine Film
+Download: C:\users\poul\Skrivebord
+Save Games 1: C:\users\poul\Mine dokumenter\My Games
+```
+
+# Encoding
+For Windows ANSI encoding is always used. Microsoft's implementation of "Unicode" is simply not compatible with platform independent code.
+For all other systems the local encoding is used. For most systems this is UTF-8.
+Generally you should only append simple ASCII chars to the paths.
+
# Licence
Provided under the MIT license for the same reason XDG is licenced under it. So that you can quickly copy-paste the methods you need or just include the "sago"-folder.
diff --git a/compile_test.sh b/compile_test.sh
new file mode 100755
index 0000000..9ec398a
--- /dev/null
+++ b/compile_test.sh
@@ -0,0 +1,12 @@
+#! /bin/bash
+set -e
+#This script will attempt to compile with C++11, cross compile to windows with C++11, cross compile to windows with C++03, compile with C++03
+make clean
+make TESTCPP11=1
+make clean
+make CROSS=i686-pc-mingw32- TESTCPP11=1
+make clean
+make CROSS=i686-pc-mingw32-
+mv platform_folders.out platform_folders.exe
+make clean
+make
diff --git a/sago/platform_folders.cpp b/sago/platform_folders.cpp
index 9699868..c3024d8 100644
--- a/sago/platform_folders.cpp
+++ b/sago/platform_folders.cpp
@@ -40,7 +40,7 @@
static std::string GetWindowsFolder(int folderId, const char* errorMsg) {
char szPath[MAX_PATH];
szPath[0] = 0;
- if ( !SUCCEEDED( SHGetFolderPath( NULL, folderId, NULL, 0, szPath ) ) )
+ if ( !SUCCEEDED( SHGetFolderPathA( NULL, folderId, NULL, 0, szPath ) ) )
{
throw std::runtime_error(errorMsg);
}