|
From: <jde...@us...> - 2009-04-18 00:44:29
|
Revision: 9862
http://pcgen.svn.sourceforge.net/pcgen/?rev=9862&view=rev
Author: jdempsey
Date: 2009-04-18 00:44:25 +0000 (Sat, 18 Apr 2009)
Log Message:
-----------
Fix bug: Save character fails on Windows Vista
Issue#: 2771673
Modified Paths:
--------------
branches/5.16.x/pcgen/code/src/java/pcgen/core/Globals.java
branches/5.16.x/pcgen/code/src/java/pcgen/core/SettingsHandler.java
Modified: branches/5.16.x/pcgen/code/src/java/pcgen/core/Globals.java
===================================================================
--- branches/5.16.x/pcgen/code/src/java/pcgen/core/Globals.java 2009-04-16 11:49:53 UTC (rev 9861)
+++ branches/5.16.x/pcgen/code/src/java/pcgen/core/Globals.java 2009-04-18 00:44:25 UTC (rev 9862)
@@ -108,7 +108,7 @@
/** NOTE: The defaultPath is duplicated in LstSystemLoader. */
private static final String defaultPath = System.getProperty("user.dir"); //$NON-NLS-1$
- private static final String defaultPcgPath = getDefaultPath() + File.separator + "characters"; //$NON-NLS-1$
+ private static final String defaultPcgPath = Globals.getUserFilesPath() + File.separator + "characters"; //$NON-NLS-1$
private static final String backupPcgPath = Constants.EMPTY_STRING;
/** These are for the Internationalization project. */
@@ -647,6 +647,15 @@
}
/**
+ * Get the default path
+ * @return default path
+ */
+ public static String getUserFilesPath()
+ {
+ return expandRelativePath(System.getProperty("user.home") + File.separator + ".pcgen");
+ }
+
+ /**
* Get the backup pcg path
* @return backup pcg path
*/
Modified: branches/5.16.x/pcgen/code/src/java/pcgen/core/SettingsHandler.java
===================================================================
--- branches/5.16.x/pcgen/code/src/java/pcgen/core/SettingsHandler.java 2009-04-16 11:49:53 UTC (rev 9861)
+++ branches/5.16.x/pcgen/code/src/java/pcgen/core/SettingsHandler.java 2009-04-18 00:44:25 UTC (rev 9862)
@@ -1239,9 +1239,9 @@
setPccFilesLocation(new File(expandRelativePath(getPCGenOption("pccFilesLocation", //$NON-NLS-1$
System.getProperty("user.dir") + File.separator + "data")))); //$NON-NLS-1$ //$NON-NLS-2$
setPcgenCustomDir(new File(expandRelativePath(getOptions().getProperty("pcgen.files.pcgenCustomDir", //$NON-NLS-1$
- System.getProperty("user.dir") + File.separator + "data" + File.separator + "customsources")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Globals.getUserFilesPath() + File.separator + "customsources")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
setPcgenVendorDataDir(new File(expandRelativePath(getOptions().getProperty("pcgen.files.pcgenVendorDataDir", //$NON-NLS-1$
- System.getProperty("user.dir") + File.separator + "vendordata")))); //$NON-NLS-1$ //$NON-NLS-2$
+ Globals.getUserFilesPath() + File.separator + "vendordata")))); //$NON-NLS-1$ //$NON-NLS-2$
setPcgenDocsDir(new File(expandRelativePath(getOptions().getProperty("pcgen.files.pcgenDocsDir", //$NON-NLS-1$
System.getProperty("user.dir") + File.separator + "docs")))); //$NON-NLS-1$ //$NON-NLS-2$
setPcgenSystemDir(new File(expandRelativePath(getOptions().getProperty("pcgen.files.pcgenSystemDir", //$NON-NLS-1$
@@ -1258,7 +1258,7 @@
Globals.getDefaultPcgPath()))));
setBackupPcgPath(new File(expandRelativePath(getOptions().getProperty("pcgen.files.characters.backup", "")))); //$NON-NLS-1$
setPortraitsPath(new File(expandRelativePath(getOptions().getProperty("pcgen.files.portraits", //$NON-NLS-1$
- Globals.getDefaultPath()))));
+ Globals.getDefaultPcgPath()))));
setPostExportCommandStandard(getPCGenOption("postExportCommandStandard", "")); //$NON-NLS-1$ //$NON-NLS-2$
setPostExportCommandPDF(getPCGenOption("postExportCommandPDF", "")); //$NON-NLS-1$ //$NON-NLS-2$
setPrereqFailColor(getPCGenOption("prereqFailColor", Color.red.getRGB())); //$NON-NLS-1$
@@ -1775,6 +1775,10 @@
*/
public static void setPcgPath(final File path)
{
+ if (path != null && !path.exists())
+ {
+ path.mkdirs();
+ }
pcgPath = path;
}
@@ -1790,6 +1794,10 @@
public static void setPcgenCustomDir(final File aFile)
{
+ if (aFile != null && !aFile.exists())
+ {
+ aFile.mkdirs();
+ }
pcgenCustomDir = aFile;
}
@@ -1800,6 +1808,10 @@
public static void setPcgenVendorDataDir(final File aFile)
{
+ if (aFile != null && !aFile.exists())
+ {
+ aFile.mkdirs();
+ }
pcgenVendorDataDir = aFile;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|