Changeset 1426 for trunk/src/org/expeditee/items/ItemUtils.java
- Timestamp:
- 07/31/19 15:51:04 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/ItemUtils.java
r1415 r1426 400 400 } 401 401 fileName = path; 402 403 // try images subdirectory 404 File file = null; 405 406 for (String dir : FolderSettings.ImageDirs.getAbsoluteDirs()) { 407 file = new File(dir + path); 408 if (file.exists() && !file.isDirectory()) { 409 break; 410 } 411 } 412 413 if (file == null || !file.exists() || file.isDirectory()) { 402 403 if (!fileName.equals(Picture.REDACTED_IMAGE_NAME)) { 404 // try images subdirectory 405 File file = null; 406 407 for (String dir : FolderSettings.ImageDirs.getAbsoluteDirs()) { 408 file = new File(dir + path); 409 if (file.exists() && !file.isDirectory()) { 410 break; 411 } 412 } 413 414 if (file == null || !file.exists() || file.isDirectory()) { 415 file = new File(path); 416 } 417 418 // try relative path 419 if (!file.exists() || file.isDirectory()) { 420 URL picture = new Object().getClass().getResource(path); 421 422 // decode to remove %20 in windows folder names 423 if (picture != null) { 424 try { 425 path = URLDecoder.decode(picture.getFile(), "UTF-8"); 426 } catch (UnsupportedEncodingException e) { 427 // TODO Auto-generated catch block 428 e.printStackTrace(); 429 } 430 } 431 432 } else { 433 path = file.getPath(); 434 } 435 436 // if the image isn't found by now, try remote servers 414 437 file = new File(path); 415 } 416 417 // try relative path 418 if (!file.exists() || file.isDirectory()) { 419 URL picture = new Object().getClass().getResource(path); 420 421 // decode to remove %20 in windows folder names 422 if (picture != null) { 423 try { 424 path = URLDecoder.decode(picture.getFile(), "UTF-8"); 425 } catch (UnsupportedEncodingException e) { 426 // TODO Auto-generated catch block 427 e.printStackTrace(); 428 } 429 } 430 431 } else { 432 path = file.getPath(); 433 } 434 435 // if the image isn't found by now, try remote servers 436 file = new File(path); 437 if (!file.exists() || file.isDirectory()) { 438 if(tryRemote && FrameShare.getInstance().loadImage(fileName, null)) { 439 // call CreatePicture again, but with tryRemote set to false so we won't get into an infinite loop 440 // if something goes wrong with finding the downloaded image 441 return CreatePicture(source, false); 442 } 443 return null; 444 } 445 438 if (!file.exists() || file.isDirectory()) { 439 if(tryRemote && FrameShare.getInstance().loadImage(fileName, null)) { 440 // call CreatePicture again, but with tryRemote set to false so we won't get into an infinite loop 441 // if something goes wrong with finding the downloaded image 442 return CreatePicture(source, false); 443 } 444 return null; 445 } 446 } 446 447 } catch (Exception e) { 447 448 return null;
Note:
See TracChangeset
for help on using the changeset viewer.