mirror of
				https://github.com/smartfrigde/armcord.git
				synced 2024-08-14 23:56:58 +00:00 
			
		
		
		
	Add portable mode (#280)
This commit is contained in:
		
							parent
							
								
									52b1ff77f8
								
							
						
					
					
						commit
						378fef1a0e
					
				
					 3 changed files with 12 additions and 1 deletions
				
			
		|  | @ -1,7 +1,7 @@ | |||
| // Modules to control application life and create native browser window
 | ||||
| import {app, BrowserWindow, session} from "electron"; | ||||
| import "v8-compile-cache"; | ||||
| import {getConfig, checkIfConfigExists, injectElectronFlags, installModLoader} from "./utils"; | ||||
| import {checkForDataFolder, getConfig, checkIfConfigExists, injectElectronFlags, installModLoader} from "./utils"; | ||||
| import "./extensions/mods"; | ||||
| import "./tray"; | ||||
| import {createCustomWindow, createNativeWindow, createTransparentWindow, mainWindow} from "./window"; | ||||
|  | @ -22,6 +22,7 @@ if (process.platform == "linux") { | |||
|         } | ||||
|     } | ||||
| } | ||||
| checkForDataFolder(); | ||||
| checkIfConfigExists(); | ||||
| injectElectronFlags(); | ||||
| app.whenReady().then(async () => { | ||||
|  |  | |||
|  | @ -1,5 +1,6 @@ | |||
| import {BrowserWindow, shell, ipcMain, app, clipboard} from "electron"; | ||||
| import { | ||||
|     checkForDataFolder, | ||||
|     getConfig, | ||||
|     setConfigBulk, | ||||
|     Settings, | ||||
|  | @ -16,6 +17,7 @@ import fs from "fs"; | |||
| import {mainWindow} from "../window"; | ||||
| var settingsWindow: BrowserWindow; | ||||
| var instance: number = 0; | ||||
| checkForDataFolder(); | ||||
| const userDataPath = app.getPath("userData"); | ||||
| const storagePath = path.join(userDataPath, "/storage/"); | ||||
| const themesPath = path.join(userDataPath, "/themes/"); | ||||
|  |  | |||
|  | @ -222,6 +222,14 @@ export async function getWindowState(object: string) { | |||
| } | ||||
| //ArmCord Settings/Storage manager
 | ||||
| 
 | ||||
| export function checkForDataFolder() { | ||||
|     const dataPath = path.join(path.dirname(app.getPath("exe")), "armcord-data"); | ||||
|     if (fs.existsSync(dataPath) && fs.statSync(dataPath).isDirectory()) { | ||||
|         console.log("Found armcord-data folder. Running in portable mode."); | ||||
|         app.setPath("userData", dataPath); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| export interface Settings { | ||||
|     windowStyle: string; | ||||
|     channel: string; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue