Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Enable Portable Mode - #8442

Merged
kevinsawicki merged 25 commits into
masterfrom
portable-mode
Nov 3, 2015
Merged

kevinsawicki merged 25 commits into
masterfrom
portable-mode

Conversation

@anaisbetts

Copy link
Copy Markdown
Contributor

This PR sets the default ATOM_HOME to be relative to atom.exe, if the following cases are true:

  1. We're not in DevMode
  2. We're on Windows
  3. The EXE path is not in the normal installed location

This allows users to take the entire Atom folder and use it as a "Portable" application (i.e. portableapps.com)

Fixes #2939

TODO:

  • Make sure this actually works
  • Add .alwaysportable directive (Gonna see if people want this or not)
  • Code Review

@thomasjo

Copy link
Copy Markdown
Contributor

Looks promising 🎱

Comment thread static/index.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this comparison include a trailing slash on USERPROFILE?

Currently this check will pass for the following process.execPath/USERPROFILE right?

process.execPath = C:\Users\KevinSawicki\atom\atom.exe
USERPROFILE = C:\Users\Kevin

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a typo that I fixed but didn't push apparently, this should be LOCALAPPDATA, which makes way more sense :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, totally 👍

@kevinsawicki

Copy link
Copy Markdown
Contributor

So the idea here is that is they install to USERPROFILE then it is portable? And a squirrel installer never goes there in any cases?

@kevinsawicki

Copy link
Copy Markdown
Contributor

So the idea here is that if they install to USERPROFILE then it is portable?

Nevermind, it is the other way around right? Not in USERPROFILE means portable mode?

@anaisbetts

Copy link
Copy Markdown
Contributor Author

So the idea here is that is they install to USERPROFILE then it is portable? And a squirrel installer never goes there in any cases?

Peep the line comment above, things will make way more sense then

@lee-dohm

Copy link
Copy Markdown
Contributor

Something I thought of because someone was asking about installing to the D:\ drive the other day. If someone installs applications to a non-standard directory for disk space reasons, it will automatically start behaving as a portable application?

@anaisbetts

Copy link
Copy Markdown
Contributor Author

@lee-dohm Correct, but because this person probably (maybe?) already has an existing .atom folder in their home directory, we'll prefer that over the portable path

@batjko

batjko commented Aug 22, 2015

Copy link
Copy Markdown
Contributor

I don't think this will satisfy those people who keep waiting for a portable version.
Portable should be entirely independent, by default always read and write its settings and plugins only from the installation directory (wherever was chosen by the installing user) - entirely independent of what is already installed or not. It shouldn't care at all if there are already 50 other Atoms installed, and only use its own .atom folder.

This conditional checking of already installed versions and preferring the "remote" .atom folder over its own... it just brings us back to the same situation that exists currently.

What people keep asking for is a separate version of Atom. One that, as described, doesn't need to be installed (it's supposed to be already runnable from the folder people unzipped), and which doesn't care about where it runs from or whether there are other versions installed elsewhere on the system.

I don't need a portable version myself, but just wanted to point that out.

@anaisbetts

Copy link
Copy Markdown
Contributor Author

@batjko This might be true, but then that gets us into creating separate builds for Portable Windows which sucks. I can add a check for an .alwaysPortable dot-file that makes us always ignore ~/.atom

@batjko

batjko commented Aug 22, 2015

Copy link
Copy Markdown
Contributor

but then that gets us into creating separate builds for Portable Windows which sucks

True, unless the portable version is cross-platform, but it would still need to be maintained separately.

I can add a check for an .alwaysPortable dot-file that makes us always ignore ~/.atom

That sounds like a pretty nifty way to do it. Generally, if an .alwaysPortable file exists, rely only on your local install folder.

This PR sets the default ATOM_HOME to be relative to atom.exe, if the
following cases are true:

1. We're not in DevMode
1. We're on Windows
1. The EXE path is not in the normal installed location

This allows users to take the entire Atom folder and use it as a
"Portable" application (i.e. portableapps.com)
@anaisbetts

Copy link
Copy Markdown
Contributor Author

I can add a check for an .alwaysPortable dot-file that makes us always ignore ~/.atom

Let's punt on this for now and see if people ask for it

@anaisbetts

Copy link
Copy Markdown
Contributor Author

@kevinsawicki Plz to review!

Comment thread src/browser/main.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think you need the process and check here, since the line before already calls process.platform without checking process.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is copy-pasta from the apm version, will fix

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What is the use of checking process.type here?
I am newbie :P

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@PikachuEXE No use in this case, copy pasta from apm

@kevinsawicki

Copy link
Copy Markdown
Contributor

Will this work if they have installed Atom directly to Program Files via downloading atom-windows.zip?

Comment thread src/browser/main.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you add a comment above this line that just adds some example paths and says which ones are considered portable and which ones are not?

@anaisbetts

Copy link
Copy Markdown
Contributor Author

Will this work if they have installed Atom directly to Program Files via downloading atom-windows.zip

No, because we'll try to write to C:\Program Files\Atom\.atom which will fail because of no permissions

Conflicts:
	src/browser/main.coffee
According to these specifications:
Portable mode only applies to Windows (for now)
Portable mode only applies if ATOM_HOME is not set
If there is a .atom directory as sibling to directory with running process
	use that as ATOM_HOME
always set at the process level, so always set here
Comment thread src/browser/main.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this line needed? The return value doesn't appear to be used

@methodbox

Copy link
Copy Markdown

WTF is this still using coffeescript ??

@damieng

damieng commented Apr 4, 2016

Copy link
Copy Markdown
Contributor

You do not need to specify atom_home at all. Details on portable mode are in the flight manual. The stuff stored in app data are caches and temp files. It's quite common for portable apps to continue to use temp files in this way. Let us know if you find it storing something else there you think should really be on the portable drive.

@colelawrence

Copy link
Copy Markdown
Contributor

@damieng Thank you for clarifying, but a "portable" software should not leave traces on a computer, see the portable application guidelines followed by Portable Apps. Ensuring that no files are stored in a folder like the APPDATA, enables someone to run multiple versions of Atom, with different packages and different styling set ups.

Thus, if they want to use Atom for Go, they can set it up with the best syntax theme for go, and the best linters, packages, and config, but still be able to use another installation of Atom for lightweight text editing.

@damieng

damieng commented Apr 4, 2016

Copy link
Copy Markdown
Contributor

Nothing Atom's mode does today precludes you from running any of your scenarios. The files in AppData today are temp/cache files. You can do everything you just said. All the important configurations, packaging and styling are stored on the portable drive.

PortableApp's definition doesn't say you can't use AppData for cache/temp (storing those files on a USB stick would be awful for performance) just that it shouldn't leave a trace. The solution here might be to just aggressively clean up the cache/temp files when running in portable mode.

@dogancelik

Copy link
Copy Markdown
  • I store Atom in E:\Portable\Atom
  • I start E:\Portable\Atom\Atom.exe --portable
  • It creates E:\Portable\.atom

That's not what Portable means. Portable means it would store .atom inside the program folder where Atom.exe resides.

If you try to move your Atom folder, you have to move .atom too every time you need to move Atom to somewhere else. And that's not handy (or portable).

That's like having to hold a suitcase but you also have to hold another one because they love each other and can't do without the other. So wearing a backpack instead (Portable mode) is much better (Atom configuration folder inside Atom program folder) and less burden on Portable people.

What happens if I put all Atom files in root E:\, is Atom going to create a folder E:\..\.atom (basically inside My Computer)?

Using a file portablemode to activate Portable mode is a common practice among Windows developers. Many popular programs in Windows use this convention. Examples: Foobar2000, TeraCopy, ShareX, QuiteRSS, RetroShare etc.

@damieng

damieng commented Apr 14, 2016

Copy link
Copy Markdown
Contributor

Because of the way the auto-updater works it can't store .atom inside Atom as the Atom folder gets replaced with the new version.

That's not what Portable means. Portable means it would store .atom inside the program folder where Atom.exe resides.

Portable means just that, portable between machines. There isn't a specific definition that states config has to be stored directly in the folder or that the app can't use temporary storage on the machine.

@dogancelik

Copy link
Copy Markdown

I'm getting errors when uninstalling packages as they get removed from the filesystem but doesn't get removed from Atom itself.

  • ATOM_HOME=E:\Portable\.atom
  • No --portable is passed
  • Local Atom installation, %LocalAppData%\Atom\app-1.7.0

altgr

Console log:

C:\Users\dogan\AppData\Local\atom\app-1.7.0\resources\app.asar\node_modules\settings-view\lib\package-card.js:721 Uninstalling package altgr failed Error: Uninstalling “altgr” failed.
    at C:\Users\dogan\AppData\Local\atom\app-1.7.0\resources\app.asar\node_modules\settings-view\lib\package-manager.js:504:21
    at exit (C:\Users\dogan\AppData\Local\atom\app-1.7.0\resources\app.asar\node_modules\settings-view\lib\package-manager.js:73:16)
    at triggerExitCallback (C:\Users\dogan\AppData\Local\atom\app-1.7.0\resources\app.asar\src\buffered-process.js:215:47)
    at ChildProcess.<anonymous> (C:\Users\dogan\AppData\Local\atom\app-1.7.0\resources\app.asar\src\buffered-process.js:237:18)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) Failed to delete altgr: Does not exist

@proimage

Copy link
Copy Markdown

I appreciate all the hard work going into this, but wouldn't it be easier not to re-invent the (portable) wheel? Why not just implement according to the de facto portable standard set by PortableApps.com?

@damieng

damieng commented Apr 15, 2016 •

Copy link
Copy Markdown
Contributor

This is not a case of reinventing a definition to be different but rather working with some hard limitations. If the config file is inside the app folder it will get blown away during update.

If you wanted to not use the auto update you could easily create a cmd file to launch atom with the config file inside the folder. This would live inside the Atom folder perhaps named atomp.cmd and the contents would be:

@echo off
set ATOM_HOME=%~dp0
atom.exe %*

(The way SET works would not SET anything on this machine it is for the duration of this process only)

@colelawrence

Copy link
Copy Markdown
Contributor

And there is a --user-data-dir flag you need to pass to Atom if you want
all its files contained in the install directory, ://
github.com/atom/atom/blob/f48069c5f848b5ae624b110a1df7800e919eb142/src/browser/main.coffee

On Fri, 15 Apr 2016, 9:14 AM Damien Guard [email protected] wrote:

This is not a case of reinventing a definition to be different but rather
working with some hard limitations.

If you wanted to not use the auto update you could easily create a cmd
file to launch atom with the config file inside the folder. This would live
inside the Atom folder perhaps named atomp.exe and the contents would be:

@echo off
set ATOM_HOME=%~dp0
atom.exe %*

(Note the way SET works would not leave anything on this machine)

—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#8442 (comment)

ennoweichert referenced this pull request in garethflowers/atom-portable Apr 20, 2016
@Gubith

Gubith commented Apr 23, 2016

Copy link
Copy Markdown

This works for me:
\portable\edit\atom\atom\
\portable\edit\atom\.atom\

No need to change the folder structure.

I put my custom startup here:
\portable\edit\atom\StartAtom.cmd

Also, I tested multiple installs - ssd portable install copied to an IMDisk ramdrive. Both open about the same with a minimum install (3300 files) and work fine individually. But when one is open already, the second uses the first ones profile. This may be expected behavior, I don't need to run more than one at at time, just want to point this out in case it's unexpected. After exiting both and running one at a time, they have their own profiles intact.

@neojp

neojp commented Jun 25, 2016

Copy link
Copy Markdown

Someone asked about documentation on this matter a while ago. May I mention PortableApps? They have been doing this for years.

http://portableapps.com/development

@michaelmano

michaelmano commented Sep 8, 2016 •

Copy link
Copy Markdown

If you want you can also do this. Install Google Drive if you dont have it

please note the usernames and also make sure your google drive has the folders already made

Programs
Programs->Atom
Programs->Atom->Local
Programs->Atom->Local->atom
Programs->Atom->Roaming
Programs->Atom->Roaming->Atom

mklink /D "C:\Users\USERNAME HERE.atom" "C:\Users\USERNAME HERE\Google Drive\Programs\Atom"
mklink /D "C:\Users\USERNAME HERE\AppData\Local\atom" "C:\Users\USERNAME HERE\Google Drive\Programs\Atom\Local\atom"
mklink /D "C:\Users\USERNAME HERE\AppData\Roaming\Atom" "C:\Users\USERNAME HERE\Google Drive\Programs\Atom\Roaming\Atom"

Once these links have been created you can now install atom.

If you wish to use atom on another pc just make a batch file with the above symlinks or copy paste them into the new pc and your done as long as you have drive installed (This can be on usb but why bother)

@ghost ghost mentioned this pull request Oct 1, 2016
@Arlen22

Arlen22 commented Nov 15, 2016

Copy link
Copy Markdown

Really curious where this is at. I would also like portable capability. I really don't care if I have to put the Atom files folder inside a AtomPortable folder and have the .atom folder next to it. That is how PortableApps are usually setup. But it would be good to have the ability to set each kind of folder (profile/cache/temp) from the command line, so that people running off a thumb drive can use the standard temp folder, and people running off a more durable storage drive would be able put the other stuff on as well.

atom.exe -profile ..\data\profile -cache ..\data\cache -temp ..\data\temp

Why can't we implement ALL of the options that have been proposed? I'm sure some of them have problems related to specific implementations. I also like the idea of checking for a file or checking in the parent directory.

The point is that there are several different use cases here, and I think we can satisfy all of them. We don't need to make this simple and easy, rather we should make it granular and versatile. And well documented, of course.

@Arlen22

Arlen22 commented Nov 15, 2016

Copy link
Copy Markdown

Actually, just comprehended that this got merged. Thanks for making a way. My suggestion still stands, but one way is better than no way :)

@too-gee

too-gee commented Apr 4, 2017 •

Copy link
Copy Markdown

I dug into the PortableApps spec a little bit and found out that they have a really nice template for people wishing to make their own. Unzip the attached file, and then unzip the contents of the latest Atom zip release for windows into the new "AtomPortable/App/Atom" directory.

The launcher in the root of the zip will launch "AtomPortable/App/Atom/atom.exe". If a C:*user*.atom folder exists, it will be temporarily renamed and the portable version's folder will be placed there. Once the portable version is closed, the contents of .atom are restored to the portable device and the old .atom directory is restored. This will, of course, result in slower load times, but it does get the job done. Atom is launched with the ATOM_HOME env variable set (and unset when closed). A Atom folder in Roaming Data is still created, but is deleted after the app has run. True to the PortableApps standard, everything is stored in the "Data" directory of the app.

Also, here is a pre-packaged version of the 1.15 release. Haven't tested this method heavily, but so far it seems to provide satisfactory results.

Edited to remove unofficial Atom distribution

@lee-dohm

lee-dohm commented Apr 4, 2017

Copy link
Copy Markdown
Contributor

@TeejMonster I applaud the effort and work you put into this. However, we aren't going to allow a link to an unofficial distribution of Atom here. If you want to create a repository that helps people replicate your process and link to that here, I think that would be great. Let me know if you need any help getting that going and I'd be happy to assist.

@too-gee

too-gee commented Apr 4, 2017

Copy link
Copy Markdown

I understand removing the paf file as that contained a full distribution of Atom, however, the zip file that I attached included no Atom files whatsoever and was merely a wrapper. Is that an important distinction?

@lee-dohm

lee-dohm commented Apr 4, 2017

Copy link
Copy Markdown
Contributor

@TeejMonster Ah, I didn't look inside it ... I thought they were different forms of the same thing. In any case, setting up a repo still seems the right thing to do so that people can examine the files before downloading them.

@too-gee

too-gee commented Apr 4, 2017

Copy link
Copy Markdown

@lee-dohm Fair enough. Thanks for the push.

You can find the wrapper in its current state here. If anyone wants to help out with refining the wrapper, I welcome the help as I have just dipped my toe into things so far.

@flawrist

flawrist commented Jul 15, 2017 •

Copy link
Copy Markdown

PortableApps lists Atom 1.13.1 (Jan ’17), latest stable Atom is 1.18 (Jun ’17), let alone beta 1.19 (Jul ’17).
Could we get the latest, portable, zip-packed (or installer with extract option) Atom at last, please?

@damieng

damieng commented Jul 15, 2017 •

Copy link
Copy Markdown
Contributor

@sergeevabc You can download atom-windows.zip from our releases page and follow the instructions at http://flight-manual.atom.io/getting-started/sections/installing-atom/#portable-mode

There is no need to download a 3rd party version of Atom such as those from PortableApps. We do not control what versions they publish nor do we test or support them.

Locking this thread to stop 36 people getting notified every time somebody has a question about the portable release. Please raise a new issue rather than comment on a 2 year old PR, thanks!

@atom atom locked and limited conversation to collaborators Jul 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

windows Issues that occur on Windows but not on other platforms.

Projects

None yet

Development

Successfully merging this pull request may close these issues.