Skip to content

Commit e8c25e6

Browse files
committedMay 4, 2025
Expanded logic for determining last modified date for wildcard includes in the FileManager
1 parent 7ac2090 commit e8c25e6

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed
 

‎src/javaxt/express/FileManager.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ public void process(Object obj){
529529
StringBuilder str = new StringBuilder();
530530
str.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n");
531531
str.append("<scripts>\r\n");
532-
for (String link : getLinks(src, path)){
532+
for (String link : getWildcardLinks(src, path)){
533533
str.append("<script src=\"");
534534
str.append(link);
535535
str.append("\"></script>\r\n");
@@ -580,7 +580,7 @@ else if (nodeName.equals("link")){
580580
StringBuilder str = new StringBuilder();
581581
str.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n");
582582
str.append("<links>\r\n");
583-
for (String link : getLinks(href, path)){
583+
for (String link : getWildcardLinks(href, path)){
584584

585585
str.append("<link href=\"");
586586
str.append(link);
@@ -618,7 +618,7 @@ else if (nodeName.equals("link")){
618618
}
619619

620620

621-
private ArrayList<String> getLinks(String src, String path) throws Exception {
621+
private ArrayList<String> getWildcardLinks(String src, String path) throws Exception {
622622

623623
//Get file path
624624
javaxt.io.File f = new javaxt.io.File(path);
@@ -631,7 +631,7 @@ private ArrayList<String> getLinks(String src, String path) throws Exception {
631631
int x = d.toString().replace("\\", "/").lastIndexOf(basePath);
632632

633633

634-
//Create new xml document
634+
//Find files and return links
635635
ArrayList<String> links = new ArrayList<>();
636636
for (javaxt.io.File file : d.getFiles(search, true)){
637637
long lastModified = file.getLastModifiedTime().getTime();
@@ -640,6 +640,14 @@ private ArrayList<String> getLinks(String src, String path) throws Exception {
640640

641641
String p = file.getDirectory().toString().replace("\\", "/").substring(x);
642642
links.add(p + file.getName() + "?v=" + currVersion);
643+
644+
//Files copied/pasted from another source may retain their
645+
//original timestamp. If these includes are older than any
646+
//other files, the newly added files will be missed on the
647+
//next load/refresh. As a workaround, we'll include a
648+
//timestamp of the parent folder. Copied folders will have a
649+
//timestamp of when the folder was copied.
650+
addDate(file.getDirectory().getLastModifiedTime().getTime());
643651
}
644652
return links;
645653
}

0 commit comments

Comments
 (0)