Skip to content
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

Respect ATOM_HOME env var for portability #5385

Merged
merged 20 commits into from Feb 4, 2015

Conversation

Projects
None yet
@kevinsawicki
Copy link
Member

kevinsawicki commented Feb 4, 2015

This PR unifies all references to use the ATOM_HOME environment variable as the location to store packages, compile caches, node headers, etc.

The location still defaults to ~/.atom when unset.

This should make Atom portable meaning it will write no files outside this location.

Closes #2939

@kevinsawicki kevinsawicki changed the title Always use ATOM_HOME env var for portability Respect ATOM_HOME env var for portability Feb 4, 2015

@kevinsawicki kevinsawicki force-pushed the ks-portable branch from 1fbc9ef to 298aed9 Feb 4, 2015

@kevinsawicki kevinsawicki referenced this pull request Feb 4, 2015

Closed

Portable version. #3320

@lee-dohm

This comment has been minimized.

Copy link
Member

lee-dohm commented Feb 4, 2015

This could also perhaps be not a "fix" for #2199, but at least allow people who prefer the .atom directory to be stored someplace else to move it where they want it?

@kevinsawicki

This comment has been minimized.

Copy link
Member Author

kevinsawicki commented Feb 4, 2015

This could also perhaps be not a "fix" for #2199

Yeah, I was planning on closing that PR after merging this since it will now be properly configurable

@kevinsawicki kevinsawicki force-pushed the ks-portable branch from 298aed9 to 4e10ea0 Feb 4, 2015

kevinsawicki added a commit that referenced this pull request Feb 4, 2015

Merge pull request #5385 from atom/ks-portable
Respect ATOM_HOME env var for portability

@kevinsawicki kevinsawicki merged commit c3bd501 into master Feb 4, 2015

4 checks passed

atom Build #1882149 succeeded in 785s
Details
atom-linux Build #1882150 succeeded in 175s
Details
atom-rpm Build #1882151 succeeded in 455s
Details
atom-win Build #1882152 succeeded in 525s
Details

@kevinsawicki kevinsawicki deleted the ks-portable branch Feb 4, 2015

@danwatco

This comment has been minimized.

Copy link

danwatco commented Feb 14, 2015

@steelbrain Just tried that, it came up with an error in the console

@steelbrain

This comment has been minimized.

Copy link
Contributor

steelbrain commented Feb 14, 2015

I am curious what that error was.

@danwatco

This comment has been minimized.

Copy link

danwatco commented Feb 14, 2015

@steelbrain It went as follows: Fatal error in V8: CALL_AND_RETRY_LAST Allocation failed - process out of memory

@steelbrain

This comment has been minimized.

Copy link
Contributor

steelbrain commented Feb 14, 2015

@danwatco Oo Lala, You might want to report it as a bug along with the repro steps.

@danwatco

This comment has been minimized.

Copy link

danwatco commented Feb 14, 2015

@steelbrain I'll open it as a bug!

@iliyang

This comment has been minimized.

Copy link

iliyang commented Mar 13, 2015

Please forgive my pedantry about this, but to me the requirement for an environment variable makes the application non-portable? As was suggested in #2939, if Atom would look in the application directory for an .atom folder (or .config or whatever), then it would be truly portable, meaning that you can plug the USB drive on a new machine and launch the executable without the need to touch any files or settings. To me, this is the definition of a portable app. I also expect most Windows users to set ATOM_HOME to point to a directory in the application folder anyway.

If I make a patch that implements the above approach, what's the chance of it being considered for merging into the repository?

Cheers!

@kevinsawicki

This comment has been minimized.

Copy link
Member Author

kevinsawicki commented Mar 13, 2015

If I make a patch that implements the above approach, what's the chance of it being considered for merging into the repository?

The application directory is completely replaced when Atom auto updates so if .atom is in there, it will be deleted when Atom next auto updates.

Perhaps there is another approach, or maybe this would only be supported for versions of Atom that don't auto update.

A PR that improves the portability of Atom would definitely be considered and appreciated though 👍

@iliyang

This comment has been minimized.

Copy link

iliyang commented Mar 13, 2015

Thanks for the reply, Kevin! OK, so if the application directory is wiped clean before updating Atom, then I guess a command-line option for setting the configuration directory is probably the next best thing. When I have some time I'll investigate how this can be achieved and prepare a PR.

@kevinsawicki

This comment has been minimized.

Copy link
Member Author

kevinsawicki commented Mar 13, 2015

When I have some time I'll investigate how this can be achieved and prepare a PR.

Sounds great, thanks for taking a look at this.

@iliyang

This comment has been minimized.

Copy link

iliyang commented Mar 13, 2015

I just tried the "portable" Atom on my Windows 8.1 x64 by setting the ATOM_HOME environment variable. Upon launch, Atom does indeed write in the directory pointed by ATOM_HOME, but it also creates a %APPDATA%/Atom directory.

Files/dirs created in ATOM_HOME:

  • .apm
  • compile-cache
  • config.cson

Files/dirs created in %APPDATA%\Atom:

  • Cache
  • Cookies
  • Cookies-journal
  • GPUCache
  • Local Storage

Is there no way to make it write everything in the ATOM_HOME dir?

@danwatco

This comment has been minimized.

Copy link

danwatco commented Mar 13, 2015

@iliyang I've just re tried again by setting the atom home, and it works for me! Off a usb stick too! Does the information stored in app data affect your settings in any way?

@iliyang

This comment has been minimized.

Copy link

iliyang commented Mar 13, 2015

@danwatco What do you mean it works? That the settings are properly stored in ATOM_HOME and preserved? I can believe that, but I still think that writing to %APPDATA% is undesirable and does against the definition of a predictable, portable app.

Can you please check your %APPDATA% directory for an Atom folder?

@danwatco

This comment has been minimized.

Copy link

danwatco commented Mar 13, 2015

@iliyang Sorry, I was referencing that it worked as I tried before with no luck. Still some errors though with a package I'm trying to install. Yeah it makes the same files that you stated. It's not a problem for me, but I understand what you mean

@iliyang

This comment has been minimized.

Copy link

iliyang commented May 23, 2015

Bump. Any hope of Atom only working in ATOM_HOME and not touching %APPDATA% ?

@konfuzius

This comment has been minimized.

Copy link

konfuzius commented Jun 19, 2015

@yuki-takei Add portable version of Atom · Issue #2939 · atom/atom

Windows 8.1
Atom 0.210.0

Works neatly.

.atom portable

@echo off
pushd %~dp0
if not exist .atom mkdir .atom
if not exist .atom\AppData mkdir .atom\AppData
if not exist .atom\AppData\Roaming mkdir .atom\AppData\Roaming

:: Trick emmet or other plugin to think profile directory is in our data directory
set "USERPROFILE=%~dp0\.atom"

:: Set Atom base directory
set "ATOM_HOME=%~dp0\.atom"

:: Boot
start atom
@alexchandel

This comment has been minimized.

Copy link
Contributor

alexchandel commented Jul 30, 2015

@iliyang You're absolutely right, this partial implementation does not count as portable. All temporary files must be written to Atom's folder to be portable. And by definition there can be no modification of the environment, not even via a batch-file unless it's shipped with Atom. In fact, the information that an Atom folder is portable must be entirely contained within that folder. If the updater clobbers the entire Atom folder and doesn't re-save that information, then this is a bug in the updater, by definition. The closure of #2939 is erroneous.

@notenociz

This comment has been minimized.

Copy link

notenociz commented Aug 12, 2015

Quick question, how exactly do you make your install of atom portable? Are there instructions somewhere?

@ghost

This comment has been minimized.

Copy link

ghost commented Sep 7, 2015

Sorry to ask this question but...
I have read a lot of posts on how to make atom portable I have gone through the Post #8380 and #2199, #3320, #2939 and many other posts about this but I still guess I am not getting how to make the windows version of atom portable...
I have added the .atom file to the zip file that I have downloaded (by using the .bat file implementation that is posted in here. However I often switch back and forth from mac to windows to linux and I worry that just adding the .atom file will not work across the different systems.
So I want to set the ATOM_HOME var (because that seems to be the way to do it) however I am really not sure on how to do that.

So basically what I am looking for (sorry to be a pain) is a easier to follow step by step guide to making Atom portable (especially how to set the ATOM_HOME var).

@Tapemaster21

This comment has been minimized.

Copy link

Tapemaster21 commented Oct 3, 2015

Thank you konfuzius! That seems to work wonderfully.

@CraigCarboni

This comment has been minimized.

Copy link

CraigCarboni commented Jan 11, 2016

Using "atom-windows.zip" extracted in my Downloads folder to "atom-windows" I created the following batch file which may be of use to others.

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
:: NOTE: %~dp0 already has a trailing backslash
:: enclose in double quotes in case of folder names with spaces
:: %1 to open the file when associated with a file extension in windows
:: %1 to open a file when said file "dropped" onto this batch file
PUSHD "%~dp0"
SET atom=atom.exe
SET "ATOM_HOME=%~dp0.atom"

IF EXIST "%~dp0%atom%" (
IF NOT EXIST "%~dp0.atom" MKDIR "%~dp0.atom"
START "atom.io" "%~dp0%atom%" %1
) 

IF NOT EXIST "%~dp0%atom%" (
ECHO.
ECHO.
ECHO.   Warning: %~dp0%atom% is not found!
ECHO.
ECHO.   Is atom.bat in the correct folder?
ECHO.
PAUSE
EXIT
)
EXIT
@justathoughtor2

This comment has been minimized.

Copy link

justathoughtor2 commented Feb 4, 2016

@CraigCarboni Your batch file works perfectly! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.