Skip to content

Commit 940610a

Browse files
committed
adding notes and an alternate getSettingsFolder() implementation #3838
1 parent 991ae1c commit 940610a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

app/src/processing/app/platform/WindowsPlatform.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.sun.jna.Native;
3131
import com.sun.jna.platform.win32.Kernel32Util;
3232
import com.sun.jna.platform.win32.Shell32;
33+
import com.sun.jna.platform.win32.Shell32Util;
3334
import com.sun.jna.platform.win32.ShlObj;
3435
import com.sun.jna.platform.win32.WinDef;
3536
import com.sun.jna.platform.win32.WinError;
@@ -267,7 +268,21 @@ public File getSettingsFolder() throws Exception {
267268
}
268269

269270

271+
/*
272+
What's happening internally with JNA https://github.com/java-native-access/jna/blob/master/contrib/platform/src/com/sun/jna/platform/win32/Shell32.java
273+
274+
Some goodies here: https://github.com/java-native-access/jna/blob/master/contrib/platform/src/com/sun/jna/platform/win32/Shell32Util.java
275+
http://twall.github.io/jna/4.1.0/com/sun/jna/platform/win32/Shell32Util.html#getSpecialFolderPath(int, boolean)
276+
277+
SHGetKnownFolderPath function https://msdn.microsoft.com/en-us/library/windows/desktop/bb762188(v=vs.85).aspx
278+
SHGetSpecialFolderPath https://msdn.microsoft.com/en-us/library/windows/desktop/bb762204(v=vs.85).aspx
279+
280+
http://blogs.msdn.com/b/patricka/archive/2010/03/18/where-should-i-store-my-data-and-configuration-files-if-i-target-multiple-os-versions.aspx
281+
*/
270282
static private String getAppDataPath() throws Exception {
283+
return Shell32Util.getSpecialFolderPath(ShlObj.CSIDL_APPDATA, true);
284+
285+
/*
271286
// this will be contain the path if SHGetFolderPath is successful
272287
char[] pszPath = new char[WinDef.MAX_PATH];
273288
HRESULT hResult =
@@ -284,6 +299,7 @@ static private String getAppDataPath() throws Exception {
284299
String appDataPath = new String(pszPath);
285300
int len = appDataPath.indexOf("\0");
286301
return appDataPath.substring(0, len);
302+
*/
287303
}
288304

289305

0 commit comments

Comments
 (0)