Skip to content

Commit 129fe75

Browse files
committed
Use more robust method of checking for headless
1 parent 5384469 commit 129fe75

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ lazy val rScriptFiles = settingKey[Seq[File]]("list of R scripts to include in
1414
rScriptFiles := Seq(baseDirectory.value / "src" / "rext.R", baseDirectory.value / "src" / "rlibs.R")
1515

1616
// This version number gets ignored. The NL version comes from the Language Library. --Jason B. (8/28/25)
17-
netLogoVersion := "7.0.0-RC1-e8801f2"
17+
netLogoVersion := "7.0.0-424b50b"
1818
netLogoPackageExtras ++= rScriptFiles.value.map( (f) => (f, None) )
1919
netLogoZipExtras ++= Seq(baseDirectory.value / "demos", baseDirectory.value / "README.md")
2020

src/main/scala/SRMenu.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import org.nlogo.app.App
88
import org.nlogo.core.I18N
99
import org.nlogo.swing.{ MenuItem, OptionPane }
1010

11-
import org.nlogo.languagelibrary.config.{ Config, Menu, Platform }
11+
import org.nlogo.languagelibrary.config.{ Config, Menu }
1212

1313
trait SRMenu {
1414

src/main/scala/SimpleRExtension.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ import org.json4s.JsonDSL._
1212
import org.json4s.jackson.{ JsonMethods, Json4sScalaModule }
1313

1414
import org.nlogo.languagelibrary.{ Logger, Subprocess }
15-
import org.nlogo.languagelibrary.config.{ Config, Platform }
15+
import org.nlogo.languagelibrary.config.Config
1616
import org.nlogo.languagelibrary.prims.{ EnableDebug }
1717
import org.nlogo.agent.{ Agent, AgentSet }
1818
import org.nlogo.api.{ Argument, Command, Context, DefaultClassManager, ExtensionException, ExtensionManager, FileIO, PrimitiveManager, Reporter, Workspace }
1919
import org.nlogo.core.{ LogoList, Syntax }
2020

2121
object SimpleRExtension {
22-
private var _isHeadless: Boolean = false
22+
private var _isHeadless = true
2323
def isHeadless: Boolean = _isHeadless
2424

2525
private var _codeName = "sr"
@@ -149,7 +149,7 @@ class SimpleRExtension extends DefaultClassManager {
149149
override def runOnce(em: ExtensionManager): Unit = {
150150
super.runOnce(em)
151151

152-
SimpleRExtension._isHeadless = Platform.isHeadless(em)
152+
SimpleRExtension._isHeadless = !em.workspaceContext.workspaceGUI
153153

154154
if (!SimpleRExtension.isHeadless) {
155155
SimpleRExtension.srMenu = new SRMenuGUI

test/Tests.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package org.nlogo.extensions.simpler
22

33
import java.io.File
4+
45
import org.nlogo.headless.TestLanguage
56

67
object Tests {
78
val testFileNames = Seq("tests.txt")
89
val testFiles = testFileNames.map( (f) => (new File(f)).getCanonicalFile )
910
}
1011

11-
class Tests extends TestLanguage(Tests.testFiles) {
12-
System.setProperty("org.nlogo.preferHeadless", "true")
13-
System.setProperty("java.awt.headless", "true")
14-
}
12+
class Tests extends TestLanguage(Tests.testFiles)

0 commit comments

Comments
 (0)