Changeset 441
- Timestamp:
- Nov 25, 2014, 12:53:27 AM (11 years ago)
- Location:
- trunk/icedtea-web/netx/net/sourceforge/jnlp
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/icedtea-web/netx/net/sourceforge/jnlp/browser/FirefoxPreferencesFinder.java
r429 r441 66 66 67 67 String configPath = System.getProperty("user.home") + File.separator 68 + ( Defaults.OS_DOS_LIKE ? "Mozilla" : ".mozilla")68 + (JNLPRuntime.OS_DOS_LIKE ? "Mozilla" : ".mozilla") 69 69 + File.separator + "firefox" + File.separator; 70 70 -
trunk/icedtea-web/netx/net/sourceforge/jnlp/config/Defaults.java
r429 r441 81 81 82 82 /** 83 * Whether the OS is a DOS-like (Windows, OS/2) or not.84 */85 public static final boolean OS_DOS_LIKE =86 System.getProperty("os.name").startsWith("OS/2") ||87 System.getProperty("os.name").contains("Windows");88 89 /**90 83 * Get the default settings for deployment 91 84 */ -
trunk/icedtea-web/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
r429 r441 761 761 762 762 /** 763 * @return {@code true} if running on Windows 764 */ 765 public static boolean isWindows() { 763 * Set to {@code true} if running on Windows. 764 */ 765 public static final boolean OS_WIN; 766 767 /** 768 * Set to {@code true} if running on OS/2. 769 */ 770 public static final boolean OS_OS2; 771 772 static { 766 773 String os = System.getProperty("os.name"); 767 return (os != null && os.startsWith("Windows")); 768 } 769 770 /** 771 * @return {@code true} if running on a Unix or Unix-like system (including 772 * Linux and *BSD) 773 */ 774 public static boolean isUnix() { 775 String sep = System.getProperty("file.separator"); 776 return (sep != null && sep.equals("/")); 777 } 774 OS_WIN = os != null && System.getProperty("os.name").startsWith("Windows"); 775 OS_OS2 = os != null && System.getProperty("os.name").startsWith("OS/2"); 776 } 777 778 /** 779 * Set to {@code true} if running on Windows or OS/2. 780 */ 781 public static final boolean OS_DOS_LIKE = OS_WIN || OS_OS2; 782 783 /** 784 * Set to {@code true} if running on Unix or Unix-like system (including 785 * Linux and *BSD). This is pretty much dumb ATM as it simply negates OS_DOS but it's not 786 * dumbier than the method used before (based on 'file.separator' equal to '/'). 787 */ 788 public static final boolean OS_UNIX_LIKE = !OS_DOS_LIKE; 778 789 779 790 public static void setInitialArgments(List<String> args) { -
trunk/icedtea-web/netx/net/sourceforge/jnlp/services/XBasicService.java
r429 r441 201 201 */ 202 202 private void initializeBrowserCommand() { 203 if (JNLPRuntime. isWindows()) {203 if (JNLPRuntime.OS_WIN) { 204 204 command = "rundll32 url.dll,FileProtocolHandler "; 205 } else if (JNLPRuntime. isUnix()) {205 } else if (JNLPRuntime.OS_UNIX_LIKE) { 206 206 DeploymentConfiguration config = JNLPRuntime.getConfiguration(); 207 207 command = config.getProperty(DeploymentConfiguration.KEY_BROWSER_PATH); -
trunk/icedtea-web/netx/net/sourceforge/jnlp/util/FileUtils.java
r429 r441 217 217 } 218 218 219 if (JNLPRuntime. isWindows()) {219 if (JNLPRuntime.OS_DOS_LIKE) { 220 220 // remove all permissions 221 221 if (!tempFile.setExecutable(false, false)) { … … 243 243 OutputController.getLogger().log(OutputController.Level.ERROR_ALL, R("RGetXPermFailed", tempFile)); 244 244 } 245 246 // On OS/2 and Windows, renameTo() fails if the target exists 247 // so delete it first 248 file.delete(); 249 245 250 // rename this file. Unless the file is moved/renamed, any program that 246 251 // opened the file right after it was created might still be able to … … 250 255 } 251 256 } else { 252 // remove all permissions 253 if (!Defaults.OS_DOS_LIKE) { 257 // remove all permissions 254 258 if (!tempFile.setExecutable(false, false)) { 255 259 throw new IOException(R("RRemoveXPermFailed", tempFile)); … … 258 262 throw new IOException(R("RRemoveRPermFailed", tempFile)); 259 263 } 260 } 261 if (!tempFile.setWritable(false, false)) { 262 throw new IOException(R("RRemoveWPermFailed", tempFile)); 263 } 264 265 // allow owner to read 266 if (!tempFile.setReadable(true, true)) { 267 throw new IOException(R("RGetRPermFailed", tempFile)); 268 } 269 270 // allow owner to write 271 if (writableByOwner && !tempFile.setWritable(true, true)) { 272 throw new IOException(R("RGetWPermFailed", tempFile)); 273 } 274 275 // allow owner to enter directories 276 if (isDir && !tempFile.setExecutable(true, true)) { 277 throw new IOException(R("RGetXPermFailed", tempFile)); 278 } 279 280 // rename this file. Unless the file is moved/renamed, any program that 281 // opened the file right after it was created might still be able to 282 // read the data. 283 if (Defaults.OS_DOS_LIKE) { 284 // On OS/2 and Windows, renameTo() fails if the target exists 285 // so delete it first 286 file.delete(); 287 } 288 if (!tempFile.renameTo(file)) { 289 throw new IOException(R("RCantRename", tempFile, file)); 290 } 264 if (!tempFile.setWritable(false, false)) { 265 throw new IOException(R("RRemoveWPermFailed", tempFile)); 266 } 267 268 // allow owner to read 269 if (!tempFile.setReadable(true, true)) { 270 throw new IOException(R("RGetRPermFailed", tempFile)); 271 } 272 273 // allow owner to write 274 if (writableByOwner && !tempFile.setWritable(true, true)) { 275 throw new IOException(R("RGetWPermFailed", tempFile)); 276 } 277 278 // allow owner to enter directories 279 if (isDir && !tempFile.setExecutable(true, true)) { 280 throw new IOException(R("RGetXPermFailed", tempFile)); 281 } 282 283 // rename this file. Unless the file is moved/renamed, any program that 284 // opened the file right after it was created might still be able to 285 // read the data. 286 if (!tempFile.renameTo(file)) { 287 throw new IOException(R("RCantRename", tempFile, file)); 288 } 291 289 } 292 290 … … 510 508 public static FileLock getFileLock(String path, boolean shared, boolean allowBlock) throws FileNotFoundException { 511 509 // @todo temporary solution, see http://svn.netlabs.org/java/ticket/169 512 if ( Defaults.OS_DOS_LIKE)510 if (JNLPRuntime.OS_DOS_LIKE) 513 511 return null; 514 512 RandomAccessFile rafFile = new RandomAccessFile(path, "rw"); -
trunk/icedtea-web/netx/net/sourceforge/jnlp/util/lockingfile/LockedFile.java
r427 r441 114 114 */ 115 115 public void lock() throws IOException { 116 if (JNLPRuntime.isWindows()) { 116 // @todo temporary solution, see http://svn.netlabs.org/java/ticket/169 117 if (JNLPRuntime.OS_DOS_LIKE) { 117 118 return; 118 119 } … … 141 142 */ 142 143 public void unlock() throws IOException { 143 if (JNLPRuntime.isWindows()) { 144 // @todo temporary solution, see http://svn.netlabs.org/java/ticket/169 145 if (JNLPRuntime.OS_DOS_LIKE) { 144 146 return; 145 147 } -
trunk/icedtea-web/netx/net/sourceforge/jnlp/util/logging/OutputController.java
r427 r441 347 347 348 348 private static SingleStreamLogger initSystemLogger() { 349 if (JNLPRuntime. isWindows()) {349 if (JNLPRuntime.OS_WIN) { 350 350 return new WinSystemLog(); 351 351 } else {
Note:
See TracChangeset
for help on using the changeset viewer.