Skip to content

Commit

Permalink
Launch from CLI working directory
Browse files Browse the repository at this point in the history
With GUI, launch from image directory (rather than filesystem root).

Fixes pharo-project#559
  • Loading branch information
cdlm committed May 12, 2022
1 parent 98c2030 commit dc10478
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/PharoLauncher-CLI/PhLImageLaunchCliCommand.class.st
Expand Up @@ -80,7 +80,7 @@ PhLImageLaunchCliCommand >> executeWithImage: anImage [
nextPutAll: 'Architecture mismatch, still running image if possible';
newLine].
PhLLaunchImageCommand warnOnArchMismatch: false.
anImage launch
anImage launchFrom: FileSystem workingDirectory
]

{ #category : #accessing }
Expand Down
7 changes: 7 additions & 0 deletions src/PharoLauncher-Core/PhLImage.class.st
Expand Up @@ -359,6 +359,13 @@ PhLImage >> launchConfigurations: aCollection [
launchConfigurations := aCollection
]

{ #category : #action }
PhLImage >> launchFrom: aDirectoryReference [
^ self launchWithConfiguration: (self defaultLaunchConfiguration
workingDirectory: aDirectoryReference;
yourself)
]

{ #category : #accessing }
PhLImage >> launchScript [
^ String streamContents: [ :stream |
Expand Down
14 changes: 13 additions & 1 deletion src/PharoLauncher-Core/PhLLaunchConfiguration.class.st
Expand Up @@ -15,7 +15,8 @@ Class {
'imageArguments',
'usePharoSettings',
'vm',
'vmArguments'
'vmArguments',
'workingDirectory'
],
#classVars : [
'LaunchInALoginShell'
Expand Down Expand Up @@ -126,6 +127,7 @@ PhLLaunchConfiguration >> initializeWithImage: anImage [
name := 'new configuration...'.
usePharoSettings := true.
imageArguments := anImage defaultArguments.
workingDirectory := anImage imageFile parent
]

{ #category : #testing }
Expand Down Expand Up @@ -192,3 +194,13 @@ PhLLaunchConfiguration >> vmArguments [
PhLLaunchConfiguration >> vmArguments: aCollection [
vmArguments := aCollection
]

{ #category : #accessing }
PhLLaunchConfiguration >> workingDirectory [
^ workingDirectory
]

{ #category : #accessing }
PhLLaunchConfiguration >> workingDirectory: aFileReference [
workingDirectory := aFileReference
]
Expand Up @@ -76,7 +76,7 @@ PhLLaunchImageProcessConfigurator >> usePharoSettings [
{ #category : #visiting }
PhLLaunchImageProcessConfigurator >> visit [
process := PhLProcessWrapper new.
process workingDirectory: self imageFile parent pathString.
process workingDirectory: launchConfiguration workingDirectory pathString.
self configureVm.
process
addArgument: self imageFile pathString surroundedByDoubleQuotes.
Expand Down

0 comments on commit dc10478

Please sign in to comment.