Portable version (e.g. USB drive)

It would be nice if you can copy the files and database to a pendrive and carry your anytype with you

11 Likes

I have created a workaround that seems to work as a portable version.

Prerequisites:

Disclaimer: You may loose all your files or corrupt your window’s installation if you are not sure what you are doing. You take the responsibility of what happens to your file

The idea is based on a post I saw for Obsidian. Using which I was able to create a portable version of Obsidian. Since Both Obsidian and Anytype uses Electron, I tried similar approach and it seems to work so for Anytype as well.

Step 1: Extract Anytype files installer file using 7-Zip.

Step2: Now, goto the extracted folder and extract the app-64.zip file

The extracted directory will look something like this:

Now we need to create an executable bat script that set’s a local part (necessary to make the data and settings portable) and run the Anytype file.

Best Practice!! The only way to update Anytype through this means it to repeat the steps above and paste the data and files created below in the directory of the latest version. Thus, I follow two things:

  1. Add $ sign in front of files and directory so that I don’t make mistake in moving them to the new installation.
  2. Add an underscore sign ‘_’ before exe extension so that one can’t accidently start the Anytype executable directly.

Step 3: Create a bat file and add the following text in it (you can drop the $ sign if you don’t want it)

:: Creating Folders
if not exist "%~dp0$User\ProgramData" mkdir "%~dp0$User\ProgramData"
if not exist "%~dp0$User\Public" mkdir "%~dp0$User\Public"
if not exist "%~dp0$User\AppData\Roaming" mkdir "%~dp0$User\AppData\Roaming"
if not exist "%~dp0$User\Documents" mkdir "%~dp0$User\Documents"
if not exist "%~dp0$User\AppData\Local\Temp" mkdir "%~dp0$User\AppData\Local\Temp"

:: Setting Env Variables
set ALLUSERSPROFILE=%~dp0$User\ProgramData\Roaming
set APPDATA=%~dp0$User\AppData
set LOCALAPPDATA=%~dp0$User\AppData\Local
set HOMEPATH=%~dp0$User
set ProgramData=%~dp0$User\ProgramData
set Public=%~dp0$User\Public
set TEMP=%~dp0$User\AppData\Local\Temp
set TMP=%~dp0$User\AppData\Local\Temp
set USERPROFILE=%~dp0$User

:: if not exist "%dp0$User\Documents\" goto message
goto message
goto start

:message
:echo PORTABLE Anytype
:echo -------------------------------
:pause 

:start
start $Anytype._exe

The code explanation is out of the scope. Some Anytype files may not have been captured so please feel free to indicate.

The bat file is good to go, but I want to go one step further to bring Anytype in the PortableApps interface. For this, I use Bat to EXE convertor with the following settings (You can use a custom Icon or the Anytype icon in the extracted director(it is at “\Anytype Setup 0.22.1$PLUGINSDIR\app-64\resources\app.asar.unpacked\electron\icon.ico”)

Press Convert and save the files file (I saved as $AnytypePortable)

That’s it! your Portable Anytype version should be ready. Just move the app-64 folder and you’re ready!

2 Likes