Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Description: Custom Code for mwayne's Android Studio Portable
Submitted by demondevin on November 12, 2017

[AndroidStudioPortable]
AdditionalParameters=
RunLocally=false
SDK=

# SDK=
; Set custom location for the Android SDK. ( set to directory before "platform-tools" )
	; ie. SDK=D:\PortableApps\CommonFiles\AndroidSDK
	; ie. SDK=X:\AndroidSDK
	; Scan Priority >>
		; [1]. SDK=
		; [2]. AndroidStudioPortable\App\AndroidStudio\sdk
		; [3]. X:\PortableApps\CommonFiles\AndroidSDK
		; [4]. Locally installed Android SDK

# AdditionalParameters=
; Pass additional command-line switches.

# RunLocally=
; Application is copied to & executed from $TEMP directory.

custom.nsh (NSIS)

${SegmentFile}

Var libclasspath
Var SDK
Var User

${SegmentInit}
	${ReadUserConfig} $0 SDK ;= User defined directory..
	IfErrors +5
	StrCmpS $0 "" +4
	IfFileExists "$0\tools\bin\sdkmanager.bat" 0 +3
	StrCpy $SDK `$0`
	Goto +6
	IfFileExists "$EXEDIR\App\AndroidStudio\sdk\tools\bin\sdkmanager.bat" 0 +3 ;= In the App directory..
	StrCpy $SDK "$EXEDIR\App\AndroidStudio\sdk"
	Goto +3
	IfFileExists "$PortableAppsDirectory\CommonFiles\AndroidSDK\tools\bin\sdkmanager.bat" 0 +2 ;= Common files directory..
	StrCpy $SDK "$PortableAppsDirectory\CommonFiles\AndroidSDK"
	IfFileExists $SDK +6
	ClearErrors
	System::Call "advapi32::GetUserName(t.r0,*i${NSIS_MAX_STRLEN})i" ;= Grabs the current username..
	StrCpy $User $0
	IfFileExists "C:\Users\$User\AppData\Local\Android\sdk\tools\bin\sdkmanager.bat" +2 ;= Locally installed version..
	StrCpy $SDK "C:\Users\$User\AppData\Local\Android\sdk"
	${SetEnvironmentVariablesPath} PAL:SDK "$SDK"
!macroend
${SegmentPre}
    ${ForEachFile} "$0" "$1" "$EXEDIR\App\android-studio\lib\*.jar"
        StrCpy $libclasspath "$libclasspath;lib\$1"
    ${NextFile}

    ${SetEnvironmentVariablesPath} PAL:libclasspath $libclasspath
!macroend
${SegmentPostPrimary}
	;= Because adb.exe will linger after exit if used.
	${IfThen} ${ProcessExists} adb.exe ${|} ${TerminateProcess} adb.exe $0 ${|}
!macroend
[Launch]
ProgramExecutable=javaw.exe
CommandLineArguments=-Djb.vmOptionsFile="%PAL:DataDir%\studio.exe.vmoptions" -XX:ErrorFile="%PAL:DataDir%\java_error_in_AS.log" -XX:HeapDumpPath="%PAL:DataDir%\java_error_in_AS.hprof" -Xbootclasspath/a:"lib\boot.jar" -Didea.config.path="%PAL:DataDir%\config" -Didea.system.path="%PAL:DataDir%\system" -Didea.plugins.path="%PAL:DataDir%\config\plugins" -Didea.log.path="%PAL:DataDir%\system\log" -Didea.platform.prefix=AndroidStudio -cp %PAL:libclasspath% com.intellij.idea.Main
WorkingDirectory=%PAL:AppDir%\android-studio
DirectoryMoveOK=yes

[Activate]
Java=require

[Environment]
ANDROID_HOME=%PAL:SDK%