Skip to content

Commit

Permalink
cancel, tell user where rpe is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
furudean committed Jul 9, 2024
1 parent ef446ed commit 6f9ac53
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
21 changes: 18 additions & 3 deletions src/lib/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,24 @@ export async function launch_renpy({
await vscode.window.showInformationMessage(
`Ren'Py Launch and Sync can install a script in your Ren'Py project to synchronize the game and editor. Would you like to install it?`,
'Yes, install',
'No, do not install'
'No, do not install',
'Cancel'
)
if (selection === 'Yes, install') {
await install_rpe({ game_root, context })
} else {
const installed_path = await install_rpe({
game_root,
context,
})
const relative_path = path.relative(
vscode.workspace.workspaceFolders?.[0].uri.fsPath ??
game_root,
installed_path
)
vscode.window.showInformationMessage(
`Ren'Py Extensions were installed at ${relative_path}`,
'OK'
)
} else if (selection === 'No, do not install') {
extensions_enabled = false
await vscode.workspace
.getConfiguration('renpyWarp')
Expand All @@ -160,6 +173,8 @@ export async function launch_renpy({
'No RPE script will be installed. Keep in mind that some features may not work as expected.',
'OK'
)
} else {
throw new Error('user cancelled')
}
} else if (!(await has_current_rpe(renpy_sh))) {
await install_rpe({ game_root, context })
Expand Down
2 changes: 1 addition & 1 deletion src/lib/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class ProcessManager {
this.instance_status_bar.show()

if (this.show_loading) {
this.instance_status_bar.text = `$(loading~spin) Loading...`
this.instance_status_bar.text = `$(loading~spin) Starting Ren'Py...`
this.instance_status_bar.command = undefined
this.instance_status_bar.tooltip = undefined

Expand Down
4 changes: 3 additions & 1 deletion src/lib/rpe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function install_rpe({
}: {
game_root: string
context: vscode.ExtensionContext
}): Promise<void> {
}): Promise<string> {
const renpy_sh = await get_renpy_sh()

if (!renpy_sh)
Expand Down Expand Up @@ -63,6 +63,8 @@ export async function install_rpe({
}

logger.info('wrote rpe to', file_path)

return file_path
}

export async function has_any_rpe(): Promise<boolean> {
Expand Down

0 comments on commit 6f9ac53

Please sign in to comment.