}
private static File getUserHome() {
- String s = System.getProperty("user.home");
- if (s != null) {
- File userDir = new File(s);
- if (userDir.exists()) {
- return userDir;
+ return toDirectory(System.getProperty("user.home"));
+ }
+
+ private static File getTempDirectory() {
+ return toDirectory(System.getProperty("java.io.tmpdir"));
+ }
+
+ private static File toDirectory(String path) {
+ if (path != null) {
+ File dir = new File(path);
+ if (dir.exists()) {
+ return dir;
}
}
return null;
if (userHome != null) {
File fopUserDir = new File(userHome, FOP_USER_DIR);
if (forWriting) {
- fopUserDir.mkdir();
+ boolean writable = fopUserDir.canWrite();
+ if (!fopUserDir.exists()) {
+ writable = fopUserDir.mkdir();
+ }
+ if (!writable) {
+ userHome = getTempDirectory();
+ fopUserDir = new File(userHome, FOP_USER_DIR);
+ fopUserDir.mkdir();
+ }
}
return new File(fopUserDir, DEFAULT_CACHE_FILENAME);
}
documents. Example: the fix of marks layering will be such a case when it's done.
-->
<release version="FOP Trunk" date="TBD">
+ <action context="Fonts" dev="JM" type="fix" fixes-bug="46686" due-to="Alok Singh">
+ Use temporary directory for the font cache if the user home directory is not
+ write-accessible.
+ </action>
<action context="Renderers" dev="JM" type="fix" fixes-bug="45342" due-to="Emil Maskovsky">
AFP Fonts: Fixed interpretation of metric for fonts with fixed metrics and made sure
all repeating groups in FNP (Font Position) are processed.