Ignore:
Timestamp:
09/05/18 14:29:09 (6 years ago)
Author:
bln4
Message:

org.expeditee.importer.ImageImporter ->

Now when dragging and dropping a image that is contained within Expeditee.home's images directory, the resulting @i is generated to use a relative address.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/importer/ImageImporter.java

    r1102 r1109  
    2121import java.io.File;
    2222import java.io.IOException;
     23import java.nio.file.Path;
     24import java.nio.file.Paths;
    2325import java.util.Collection;
    2426import java.util.HashSet;
     
    3032import org.expeditee.gio.gesture.StandardGestureActions;
    3133import org.expeditee.gui.DisplayController;
     34import org.expeditee.gui.FrameIO;
    3235import org.expeditee.gui.FrameUtils;
    3336import org.expeditee.items.Item;
     
    8386                        StandardGestureActions.deleteItems(enclosure, false);
    8487                }
    85 
    86                 Text source = DragAndDropManager.importString("@i: " + fullPath + size, location);
     88                Text source;
     89                final Path imagePath = Paths.get(fullPath);
     90                final Path imagesPath = Paths.get(FrameIO.IMAGES_PATH);
     91                if(imagePath.startsWith(imagesPath))
     92                        source = DragAndDropManager.importString("@i: " + imagePath.getFileName() + size, location);
     93                else source = DragAndDropManager.importString("@i: " + fullPath + size, location);
    8794                source.setThickness(thickness);
    8895                source.setBorderColor(borderColor);
Note: See TracChangeset for help on using the changeset viewer.