File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed
modules/cli/src/main/scala/scala/cli/commands Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -67,10 +67,15 @@ object Doctor extends ScalaCommand[DoctorOptions] {
67
67
println(
68
68
s " scala-cli would not be able to update itself since it is installed in multiple directories: ${scalaCliPaths.mkString(" , " )}. "
69
69
)
70
+ else if (Update .isScalaCLIInstalledByInstallationScript())
71
+ println(
72
+ s " scala-cli could update itself since it is correctly installed in only one location: ${scalaCliPaths.mkString}. "
73
+ )
70
74
else
71
75
println(
72
- s " scala-cli could update itself since it is correctly installed in only one location: $scalaCliPaths. "
76
+ s " scala-cli can be updated by your package manager since it is correctly installed in only one location: ${ scalaCliPaths.mkString} . "
73
77
)
78
+
74
79
}
75
80
76
81
private def checkNativeDependencies (): Unit = {
Original file line number Diff line number Diff line change @@ -156,16 +156,20 @@ object Update extends ScalaCommand[UpdateOptions] {
156
156
}
157
157
158
158
def checkUpdateSafe (logger : Logger ): Unit =
159
- try {
160
- val classesDir =
161
- getClass.getProtectionDomain.getCodeSource.getLocation.toURI.toString
162
- val binRepoDir = build.Directories .default().binRepoDir.toString()
159
+ try
163
160
// log about update only if scala-cli was installed from installation script
164
- if (classesDir.contains(binRepoDir ))
161
+ if (isScalaCLIInstalledByInstallationScript( ))
165
162
checkUpdate(UpdateOptions (isInternalRun = true ))
166
- }
167
163
catch {
168
164
case NonFatal (ex) =>
169
165
logger.debug(s " Ignoring error during checking update: $ex" )
170
166
}
167
+
168
+ def isScalaCLIInstalledByInstallationScript (): Boolean = {
169
+ val classesDir =
170
+ getClass.getProtectionDomain.getCodeSource.getLocation.toURI.toString
171
+ val binRepoDir = build.Directories .default().binRepoDir.toString()
172
+
173
+ classesDir.contains(binRepoDir)
174
+ }
171
175
}
You can’t perform that action at this time.
0 commit comments