Changeset 1524 for trunk


Ignore:
Timestamp:
03/24/20 09:40:55 (4 years ago)
Author:
bnemhaus
Message:

Added ability to have ${EXPEDITEE.HOME} used in @File annotations.

Location:
trunk/src/org/expeditee/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/Frame.java

    r1513 r1524  
    6161import org.expeditee.gio.input.KBMInputEvent.Key;
    6262import org.expeditee.gio.input.StandardInputEventListeners;
     63import org.expeditee.gui.management.ResourceUtil;
    6364import org.expeditee.io.Conversion;
    6465import org.expeditee.io.ExpReader;
     
    29302931        }
    29312932
    2932         public String getExportFileTagValue()
    2933         {
    2934                 return getAnnotationValue("file");
     2933        public String getExportFileTagValue() {
     2934                String annotationValue = getAnnotationValue("file");
     2935                Path exportPath = ResourceUtil.resolveResourcePath(annotationValue, DisplayController.getCurrentFrame());
     2936                return exportPath.toString();
    29352937        }
    29362938
  • trunk/src/org/expeditee/gui/management/ResourceManager.java

    r1516 r1524  
    312312                        for (String s: unresolved) {
    313313                                String local = ResourceUtil.substitute(s, ResourceUtil.CURRENT_FRAMESET_FLAG, p.toString());
     314                                local = ResourceUtil.substitute(local, ResourceUtil.EXPEDITEE_HOME, expediteeHome.toString());
    314315                                resolved.add(local);
    315316                        }
  • trunk/src/org/expeditee/gui/management/ResourceUtil.java

    r1447 r1524  
    2222        public static final String CURRENT_FRAMESET_FLAG = "${CURRENT_FRAMESET}";
    2323        public static final String CURRENT_USER = "${CURRENT_USER}";
     24        public static final String EXPEDITEE_HOME = "${EXPEDITEE_HOME}";
    2425       
    2526        /**
     
    6768                Text item = DisplayController.getCurrentFrame().createNewText("@i: " + out.getName());
    6869                return item;
     70        }
     71       
     72        public static Path resolveResourcePath(String unresolved, Frame context) {
     73                Path expediteeHome = Paths.get(FrameIO.PARENT_FOLDER).toAbsolutePath();
     74                Path absolutePath = Paths.get(context.getFramesetPath()).toAbsolutePath();
     75                Path p = expediteeHome.relativize(absolutePath);
     76                String resolved = ResourceUtil.substitute(unresolved, CURRENT_FRAMESET_FLAG, p.toString());
     77                resolved = ResourceUtil.substitute(resolved, EXPEDITEE_HOME, expediteeHome.toString());
     78                return Paths.get(resolved).toAbsolutePath();
    6979        }
    7080       
Note: See TracChangeset for help on using the changeset viewer.