Moved app data into user folders instead of system folders
This commit is contained in:
parent
617645e4f4
commit
8eaefb6dba
6 changed files with 118 additions and 112 deletions
|
@ -21,7 +21,7 @@ You can now start Polaris from the start menu or from your desktop, Polaris will
|
|||
|
||||
## Basic Configuration
|
||||
|
||||
All configuration is done by editing the file located at `C:\ProgramData\Polaris\polaris.toml`. Note that Polaris needs to be restarted for configuration changes to be taken into account.
|
||||
All configuration is done by editing the file located at `%appdata%\Roaming\Permafrost\Polaris\polaris.toml`. Note that Polaris needs to be restarted for configuration changes to be taken into account.
|
||||
|
||||
### Locating Your Music
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ Copy-Item .\web\ .\release\tmp\ -recurse
|
|||
|
||||
""
|
||||
"Creating installer"
|
||||
candle -wx -ext WixUtilExtension -arch x64 -out .\release\tmp\installer.wixobj .\res\windows\installer\installer.wxs
|
||||
light -wx -ext WixUtilExtension -ext WixUIExtension -spdb -out .\release\Polaris_0.5.0.msi .\release\tmp\installer.wixobj
|
||||
candle -wx -ext WixUtilExtension -arch x64 -out .\release\tmp\installer.wixobj .\res\windows\installer\installer.wxs
|
||||
light -wx -ext WixUtilExtension -ext WixUIExtension -spdb -sw1076 -out .\release\Polaris_0.5.0.msi .\release\tmp\installer.wixobj
|
||||
|
||||
"Cleaning up"
|
||||
Remove-Item -Recurse .\release\tmp
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version='1.0' encoding='windows-1252'?>
|
||||
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
|
||||
<Product Name='Polaris' Id='FE52CDDE-D982-42C9-B251-0621100244D5' UpgradeCode='959B405D-1553-411D-A4A2-CCD3E17BE0EC' Language='1033' Codepage='1252' Version='0.5.0' Manufacturer='Antoine Gersant'>
|
||||
<Product Name='Polaris' Id='4CA4E1DB-041F-4075-AE3D-34D3D0DFCEF6' UpgradeCode='C106B17B-95C0-49BB-BF1A-BC5CAD245076' Language='1033' Codepage='1252' Version='0.5.0' Manufacturer='Permafrost'>
|
||||
|
||||
<Package Id='*' Keywords='Installer' Platform='x64' InstallPrivileges='elevated' InstallScope='perMachine' Description='Polaris Installer' Manufacturer='Antoine Gersant' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
|
||||
<Package Id='*' Keywords='Installer' Platform='x64' InstallScope='perMachine' Description='Polaris Installer' Manufacturer='Permafrost' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
|
||||
|
||||
<MajorUpgrade DowngradeErrorMessage='A newer version of Polaris is already installed.' Schedule='afterInstallExecute' />
|
||||
|
||||
|
@ -11,121 +11,127 @@
|
|||
|
||||
<Directory Id='TARGETDIR' Name='SourceDir'>
|
||||
<Directory Id='ProgramFiles64Folder' Name='PFiles'>
|
||||
<Directory Id='INSTALL_DIR' Name='Polaris' FileSource='.'>
|
||||
<Directory Id='Permafrost' Name='Permafrost' FileSource='.'>
|
||||
<Directory Id='INSTALL_DIR' Name='Polaris' FileSource='.'>
|
||||
|
||||
<Component Id='MainExecutable' Guid='4E27209A-48B6-4A2A-8778-6383C83F0B24'>
|
||||
<File Source='polaris.exe' KeyPath='yes' Checksum='yes'>
|
||||
<Shortcut Id='StartupMenuPolaris' Directory='StartupFolder' Name='Polaris' WorkingDirectory='INSTALL_DIR' Icon='polaris.exe' IconIndex='0' Advertise='yes' />
|
||||
<Shortcut Id='StartMenuPolaris' Directory='ProgramMenuDir' Name='Polaris' WorkingDirectory='INSTALL_DIR' Icon='polaris.exe' IconIndex='0' Advertise='yes' />
|
||||
<Shortcut Id='DesktopPolaris' Directory='DesktopFolder' Name='Polaris' WorkingDirectory='INSTALL_DIR' Icon='polaris.exe' IconIndex='0' Advertise='yes' />
|
||||
</File>
|
||||
</Component>
|
||||
<Component Id='MainExecutable' Guid='4E27209A-48B6-4A2A-8778-6383C83F0B24'>
|
||||
<File Source='polaris.exe' KeyPath='yes' Checksum='yes'>
|
||||
<Shortcut Id='StartupMenuPolaris' Directory='StartupFolder' Name='Polaris' WorkingDirectory='INSTALL_DIR' Icon='polaris.exe' IconIndex='0' Advertise='yes' />
|
||||
<Shortcut Id='StartMenuPolaris' Directory='ProgramMenuDir' Name='Polaris' WorkingDirectory='INSTALL_DIR' Icon='polaris.exe' IconIndex='0' Advertise='yes' />
|
||||
<Shortcut Id='DesktopPolaris' Directory='DesktopFolder' Name='Polaris' WorkingDirectory='INSTALL_DIR' Icon='polaris.exe' IconIndex='0' Advertise='yes' />
|
||||
</File>
|
||||
</Component>
|
||||
|
||||
<Component Id='OpenSSLLibEAY' Guid='8F4A07F6-CADB-4001-92F6-C7184A053B3B'>
|
||||
<File Id='LibEAY' Name='libeay32.dll' Source='libeay32.dll' />
|
||||
</Component>
|
||||
|
||||
<Component Id='OpenSSLLibEAYmd' Guid='55E2AD65-293D-44BE-96C5-F61EE169478B'>
|
||||
<File Id='LibEAYmd' Name='libeay32md.dll' Source='libeay32md.dll' />
|
||||
</Component>
|
||||
|
||||
<Component Id='OpenSSLSSLEAY32md' Guid='9E115DA4-26F3-4993-BC6D-3140CBA3EF5E'>
|
||||
<File Id='SSLEAY32md' Name='ssleay32md.dll' Source='ssleay32md.dll' />
|
||||
</Component>
|
||||
|
||||
<Directory Id='web' Name='web'>
|
||||
|
||||
<Component Id='WebUIFavicon' Guid='65D5A87D-5A5C-4655-9F74-F37F4F64BB6E'>
|
||||
<File Name='favicon.png' />
|
||||
<Component Id='OpenSSLLibEAY' Guid='8F4A07F6-CADB-4001-92F6-C7184A053B3B'>
|
||||
<File Id='LibEAY' Name='libeay32.dll' Source='libeay32.dll' />
|
||||
</Component>
|
||||
|
||||
<Directory Id='img' Name='img'>
|
||||
<Component Id='WebUIImg' Guid='343BDE12-EE3E-4659-A9F8-A217B933FBF2'>
|
||||
<File Name='logo.png' />
|
||||
</Component>
|
||||
</Directory>
|
||||
|
||||
<Component Id='WebUIIndex' Guid='B666CED5-951E-40F4-8A33-E9C4FEEFF578'>
|
||||
<File Name='index.html' />
|
||||
<Component Id='OpenSSLLibEAYmd' Guid='55E2AD65-293D-44BE-96C5-F61EE169478B'>
|
||||
<File Id='LibEAYmd' Name='libeay32md.dll' Source='libeay32md.dll' />
|
||||
</Component>
|
||||
|
||||
<Directory Id='js' Name='js'>
|
||||
<Component Id='WebUIJSUtils' Guid='D5C12922-182A-4AE9-B863-D7ACA7FC2357'>
|
||||
<File Name='utils.js' />
|
||||
<Component Id='OpenSSLSSLEAY32md' Guid='9E115DA4-26F3-4993-BC6D-3140CBA3EF5E'>
|
||||
<File Id='SSLEAY32md' Name='ssleay32md.dll' Source='ssleay32md.dll' />
|
||||
</Component>
|
||||
|
||||
<Directory Id='web' Name='web'>
|
||||
|
||||
<Component Id='WebUIFavicon' Guid='65D5A87D-5A5C-4655-9F74-F37F4F64BB6E'>
|
||||
<File Name='favicon.png' />
|
||||
</Component>
|
||||
<Component Id='WebUIJSNotify' Guid='0D6CDA89-2F75-487D-B14D-FCE27DE31215'>
|
||||
<File Name='notify.js' />
|
||||
|
||||
<Directory Id='img' Name='img'>
|
||||
<Component Id='WebUIImg' Guid='343BDE12-EE3E-4659-A9F8-A217B933FBF2'>
|
||||
<File Name='logo.png' />
|
||||
</Component>
|
||||
</Directory>
|
||||
|
||||
<Component Id='WebUIIndex' Guid='B666CED5-951E-40F4-8A33-E9C4FEEFF578'>
|
||||
<File Name='index.html' />
|
||||
</Component>
|
||||
|
||||
<Directory Id='js' Name='js'>
|
||||
<Component Id='WebUIJSUtils' Guid='D5C12922-182A-4AE9-B863-D7ACA7FC2357'>
|
||||
<File Name='utils.js' />
|
||||
</Component>
|
||||
<Component Id='WebUIJSNotify' Guid='0D6CDA89-2F75-487D-B14D-FCE27DE31215'>
|
||||
<File Name='notify.js' />
|
||||
</Component>
|
||||
</Directory>
|
||||
|
||||
<Directory Id='lib' Name='lib'>
|
||||
<Component Id='WebUILibCookie' Guid='294ECB0A-2CE7-4F1F-852C-FA81E6082B4C'>
|
||||
<File Name='js.cookie.js' />
|
||||
</Component>
|
||||
<Component Id='WebUILibRiot' Guid='460200A1-6926-4FA9-98D5-A9F72555FBFC'>
|
||||
<File Name='riot+compiler.min.js' />
|
||||
</Component>
|
||||
<Component Id='WebUILibRouteTag' Guid='6728F797-21A9-4218-BD1B-074E5E005798'>
|
||||
<File Name='route+tag.min.js' />
|
||||
</Component>
|
||||
</Directory>
|
||||
|
||||
<Directory Id='tags' Name='tags'>
|
||||
<Component Id='WebUITagsApp' Guid='5B8B3B24-24B1-4B7A-8682-8858B7A93326'>
|
||||
<File Name='app.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsAuth' Guid='E1058E84-EC96-4CD8-8E51-DBB1F2DAA593'>
|
||||
<File Name='auth.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsBreadcrumbs' Guid='EA2F36E1-6182-4249-A612-06D74B491AD7'>
|
||||
<File Name='breadcrumbs.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsBrowser' Guid='576EB281-3BB8-48BC-8221-F63D674C99F3'>
|
||||
<File Name='browser.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsBrowserTabs' Guid='E02B5342-137C-4D74-93A5-AE16161E303D'>
|
||||
<File Name='browser-tabs.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsMain' Guid='B85532D1-B288-48C5-872D-31078949DFB7'>
|
||||
<File Name='main.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsPlayer' Guid='AE56FB97-E933-4369-9680-E05F89CAA01A'>
|
||||
<File Name='player.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsPlaylist' Guid='4E1E08A5-494F-4230-879C-2187706E8CEA'>
|
||||
<File Name='playlist.tag' />
|
||||
</Component>
|
||||
</Directory>
|
||||
|
||||
<Directory Id='style' Name='style'>
|
||||
<Component Id='WebUIStyle' Guid='9D8F839D-7E94-4DE4-9B22-30360C1A433D'>
|
||||
<File Name='default.css' />
|
||||
</Component>
|
||||
</Directory>
|
||||
|
||||
</Directory>
|
||||
|
||||
<Directory Id='lib' Name='lib'>
|
||||
<Component Id='WebUILibCookie' Guid='294ECB0A-2CE7-4F1F-852C-FA81E6082B4C'>
|
||||
<File Name='js.cookie.js' />
|
||||
</Component>
|
||||
<Component Id='WebUILibRiot' Guid='460200A1-6926-4FA9-98D5-A9F72555FBFC'>
|
||||
<File Name='riot+compiler.min.js' />
|
||||
</Component>
|
||||
<Component Id='WebUILibRouteTag' Guid='6728F797-21A9-4218-BD1B-074E5E005798'>
|
||||
<File Name='route+tag.min.js' />
|
||||
</Component>
|
||||
</Directory>
|
||||
|
||||
<Directory Id='tags' Name='tags'>
|
||||
<Component Id='WebUITagsApp' Guid='5B8B3B24-24B1-4B7A-8682-8858B7A93326'>
|
||||
<File Name='app.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsAuth' Guid='E1058E84-EC96-4CD8-8E51-DBB1F2DAA593'>
|
||||
<File Name='auth.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsBreadcrumbs' Guid='EA2F36E1-6182-4249-A612-06D74B491AD7'>
|
||||
<File Name='breadcrumbs.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsBrowser' Guid='576EB281-3BB8-48BC-8221-F63D674C99F3'>
|
||||
<File Name='browser.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsBrowserTabs' Guid='E02B5342-137C-4D74-93A5-AE16161E303D'>
|
||||
<File Name='browser-tabs.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsMain' Guid='B85532D1-B288-48C5-872D-31078949DFB7'>
|
||||
<File Name='main.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsPlayer' Guid='AE56FB97-E933-4369-9680-E05F89CAA01A'>
|
||||
<File Name='player.tag' />
|
||||
</Component>
|
||||
<Component Id='WebUITagsPlaylist' Guid='4E1E08A5-494F-4230-879C-2187706E8CEA'>
|
||||
<File Name='playlist.tag' />
|
||||
</Component>
|
||||
</Directory>
|
||||
|
||||
<Directory Id='style' Name='style'>
|
||||
<Component Id='WebUIStyle' Guid='9D8F839D-7E94-4DE4-9B22-30360C1A433D'>
|
||||
<File Name='default.css' />
|
||||
</Component>
|
||||
</Directory>
|
||||
|
||||
</Directory>
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
<Directory Id='CommonAppDataFolder'>
|
||||
<Directory Id='AppDataPolaris' Name='Polaris'>
|
||||
<Component Id='ConfigFile' Guid='FAF6D040-CFA2-4C56-B5EB-C8A3054294E0'>
|
||||
<File Source='polaris.toml'>
|
||||
<Permission GenericAll='yes' User='Everyone' />
|
||||
</File>
|
||||
<RemoveFolder Id='RemoveAppDataPolaris' Directory='AppDataPolaris' On='uninstall' />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id='AppDataFolder'>
|
||||
<Directory Id='AppDataPermafrost' Name='Permafrost'>
|
||||
<Directory Id='AppDataPolaris' Name='Polaris'>
|
||||
<Component Id='ConfigFile' Guid='3E84B72F-83FC-4B0B-B5FC-1347F1A03421'>
|
||||
<RegistryValue Root='HKCU' Key='Software\Permafrost\Polaris' Name='ConfigDirectory' Type='string' Value='[CONFIGDIRECTORY]' KeyPath='yes' />
|
||||
<File Source='polaris.toml'>
|
||||
<Permission GenericAll='yes' User='Everyone' />
|
||||
</File>
|
||||
<RemoveFolder Id='RemoveAppDataPolaris' Directory='AppDataPolaris' On='uninstall' />
|
||||
<RemoveFolder Id='RemoveAppDataPermafrost' Directory='AppDataPermafrost' On='uninstall' />
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
<Directory Id='DesktopFolder' Name='Desktop' />
|
||||
<Directory Id='StartupFolder' Name='Startup' />
|
||||
|
||||
<Directory Id='ProgramMenuFolder' Name='Programs'>
|
||||
<Directory Id='ProgramMenuDir' Name='Polaris'>
|
||||
<Component Id='ProgramMenuDir' Guid='9E677DF0-414B-481F-ACCC-73B2A38EC93A'>
|
||||
<Directory Id='ProgramMenuDir' Name='Permafrost'>
|
||||
<Component Id='ProgramMenuDir' Guid='228B33C8-2391-4693-A5AC-C1128F05C753'>
|
||||
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
|
||||
<RegistryValue Root='HKCU' Key='Software\Polaris' Name='ProgramMenuEntry' Type='string' Value='' KeyPath='yes' />
|
||||
<RegistryValue Root='HKCU' Key='Software\Permafrost\Polaris' Name='ProgramMenuEntry' Type='string' Value='' KeyPath='yes' />
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
@ -134,11 +140,11 @@
|
|||
|
||||
<!--Remove extra files after uninstall (db, thumbnails, etc.)-->
|
||||
<Property Id="EXTRADATAPATH">
|
||||
<RegistrySearch Root="HKLM" Key="SOFTWARE\Polaris" Name="ExtraDataPath" Type="raw" Id="ExtraDataPathSearch" />
|
||||
<RegistrySearch Root="HKCU" Key="Software\Permafrost\Polaris" Name="ExtraDataPath" Type="raw" Id="ExtraDataPathSearch" />
|
||||
</Property>
|
||||
<DirectoryRef Id="AppDataPolaris">
|
||||
<Component Id="CleanupExtraData" Guid="A74F0BA0-797F-4088-AF43-E7874AE679C7">
|
||||
<RegistryValue Root="HKLM" Key="SOFTWARE\Polaris" Name="ExtraDataPath" Type="string" Value="[AppDataPolaris]" KeyPath="yes" />
|
||||
<Component Id="CleanupExtraData" Guid="DF415F12-A1B4-48EE-98BC-E0B75AF556AD">
|
||||
<RegistryValue Root="HKCU" Key="Software\Permafrost\Polaris" Name="ExtraDataPath" Type="string" Value="[AppDataPolaris]" KeyPath="yes" />
|
||||
<util:RemoveFolderEx On="uninstall" Property="EXTRADATAPATH" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
|
|
@ -72,7 +72,7 @@ impl Config {
|
|||
if let Some(duration) = user_config.reindex_every_n_seconds {
|
||||
index_config.sleep_duration = duration;
|
||||
}
|
||||
let mut index_path = utils::get_cache_root()?;
|
||||
let mut index_path = utils::get_data_root()?;
|
||||
index_path.push(INDEX_FILE_NAME);
|
||||
index_config.path = index_path;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fn hash(path: &Path, dimension: u32) -> u64 {
|
|||
|
||||
pub fn get_thumbnail(real_path: &Path, max_dimension: u32) -> Result<PathBuf> {
|
||||
|
||||
let mut out_path = utils::get_cache_root()?;
|
||||
let mut out_path = utils::get_data_root()?;
|
||||
out_path.push(THUMBNAILS_PATH);
|
||||
|
||||
let mut dir_builder = DirBuilder::new();
|
||||
|
|
14
src/utils.rs
14
src/utils.rs
|
@ -1,12 +1,13 @@
|
|||
use app_dirs::{AppDataType, data_root};
|
||||
use app_dirs::{AppDataType, AppInfo, app_root};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::fs;
|
||||
|
||||
use errors::*;
|
||||
|
||||
const APP_INFO: AppInfo = AppInfo{name: "Polaris", author: "Permafrost"};
|
||||
|
||||
pub fn get_config_root() -> Result<PathBuf> {
|
||||
if let Ok(mut root) = data_root(AppDataType::SharedConfig) {
|
||||
root.push("Polaris");
|
||||
if let Ok(root) = app_root(AppDataType::UserConfig, &APP_INFO) {
|
||||
fs::create_dir_all(&root)
|
||||
.chain_err(|| format!("opening shared config: {}", root.display()))?;
|
||||
return Ok(root);
|
||||
|
@ -14,14 +15,13 @@ pub fn get_config_root() -> Result<PathBuf> {
|
|||
bail!("Could not retrieve config directory root");
|
||||
}
|
||||
|
||||
pub fn get_cache_root() -> Result<PathBuf> {
|
||||
if let Ok(mut root) = data_root(AppDataType::SharedData) {
|
||||
root.push("Polaris");
|
||||
pub fn get_data_root() -> Result<PathBuf> {
|
||||
if let Ok(root) = app_root(AppDataType::UserData, &APP_INFO) {
|
||||
fs::create_dir_all(&root)
|
||||
.chain_err(|| format!("opening shared data: {}", root.display()))?;
|
||||
return Ok(root);
|
||||
}
|
||||
bail!("Could not retrieve cache directory root");
|
||||
bail!("Could not retrieve data directory root");
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
|
Loading…
Add table
Reference in a new issue