Skip to content

Commit

Permalink
Only set model path when file exists and is not "empty.nlogo"
Browse files Browse the repository at this point in the history
  • Loading branch information
mrerrormessage committed Sep 6, 2017
1 parent 47f3f57 commit dc8bf21
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions netlogo-gui/src/main/window/ReconfigureWorkspaceUI.scala
Expand Up @@ -4,7 +4,7 @@ package org.nlogo.window

import java.awt.Container
import java.net.URI
import java.nio.file.Paths
import java.nio.file.{ Files, Paths }

import org.nlogo.window.Events.{ AfterLoadEvent, BeforeLoadEvent,
LoadBeginEvent, LoadEndEvent, LoadModelEvent, LoadWidgetsEvent }
Expand All @@ -23,7 +23,10 @@ object ReconfigureWorkspaceUI {
def getLinkParent = linkParent

def loadHelper(modelURI: URI, modelType: ModelType, model: Model, compilerServices: CompilerServices) {
val uriOption = Try(Paths.get(modelURI).toString).toOption
val uriOption = Try(Paths.get(modelURI)).toOption
.filterNot(p => p.getFileName.toString.startsWith("empty.nlogo"))
.filter(p => Files.isRegularFile(p))
.map(_.toString)
val beforeEvents = List(
new BeforeLoadEvent(uriOption, modelType),
new LoadBeginEvent())
Expand Down

0 comments on commit dc8bf21

Please sign in to comment.