Skip to content

feat: offer to move into Applications folder on macOS #249345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

deepak1556
Copy link
Collaborator

@deepak1556 deepak1556 commented May 20, 2025

Fixes #213909

Detect when application on macOS is installed outside the Applications folder and offer choice to move. The detection will bail early under the following cases,

  1. Application is launched from the cli (CI or perf environments). Additionally the relauncher on the runtime side cannot forward cli args so we should skip this case
  2. Application is installed in portable mode

There are 3 cases this path should cover,

  1. There are no versions of the app already present under the Applications folder

In this case, once user confirms the choice to move app.moveToApplicationsFolder will quit the current instance (which follows app.quit path in the runtime so all shutdown veto paths will be respected), copy the app to destination, trash the source app, wait for the application to exit and relaunch from the destination

  1. There is an existing version of the app in the Applications folder but is not running conflictType === exists

In this case, once user confirms the choice to move app.moveToApplicationsFolder delete the version under Applications folder and follow the same order of steps as 1)

  1. There is an existing version of the app in the Applications folder and is currently running conflictType === existsAndRunning

In this case, due to our singleton logic any new instance sharing the same user-data-dir will merge to the running instance and hence no action is needed. When using different user-data-dir the launch would happen from cli in which case the detection will bail early as mentioned before.

Question:

  1. Do we need a setting for explicit opt-out in case there are cases we haven't covered ?

@deepak1556 deepak1556 added this to the May 2025 milestone May 20, 2025
@deepak1556 deepak1556 requested a review from bpasero May 20, 2025 10:26
@deepak1556 deepak1556 self-assigned this May 20, 2025
@isidorn
Copy link
Contributor

isidorn commented May 20, 2025

Do we need a setting for explicit opt-out in case there are cases we haven't covered ?

I lean towards NO. And then we can add a setting if users complain.


if (response === 0) {
try {
const result = app.moveToApplicationsFolder({
Copy link
Member

@bpasero bpasero May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its unclear to me what moveToApplicationsFolder does under the hood? Will it trigger our shutdown handlers, for example configure files.hotExit to off, have a dirty file and trigger the move, would it still confirm shutdown and allow to veto, given there is a dirty file not saved on shutdown.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

underneath the equivalent of app.quit is called from the runtime to exit the application which should invoke all shutdown related handlers for graceful exit, I haven't tested the above flow, will confirm.

localize({ key: 'move', comment: ['&& denotes a mnemonic'] }, "&&Move to Applications"),
localize({ key: 'doNotMove', comment: ['&& denotes a mnemonic'] }, "&&Do not Move")
],
message: localize('moveToApplicationsFolderWarning', "{0} works best when run from the Applications folder", this.productService.nameLong),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it'd be nice to say something about the reason, e.g. "Auto-updating {0} works best..." or "{0} will not be able to auto-update unless you move it to the Applications folder"

@deepak1556 deepak1556 force-pushed the robo/mv_to_applications_folder branch from 7df3620 to eceb76f Compare June 2, 2025 14:27
@deepak1556 deepak1556 force-pushed the robo/mv_to_applications_folder branch from eceb76f to 4a00af9 Compare June 2, 2025 14:28
@deepak1556 deepak1556 modified the milestones: May 2025, June 2025 Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Offer to move VS Code to the Applications folder
4 participants