Store files in shared directory

This commit is contained in:
Antoine Gersant 2016-11-21 01:34:28 -08:00
parent a0b89d5acf
commit ee4a7f8f15
4 changed files with 11 additions and 10 deletions

6
Cargo.lock generated
View file

@ -3,7 +3,7 @@ name = "polaris"
version = "0.2.0"
dependencies = [
"ape 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"app_dirs 1.1.1 (git+https://github.com/agersant/app-dirs-rs)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
"id3 0.1.10 (git+https://github.com/jameshurst/rust-id3)",
@ -48,7 +48,7 @@ dependencies = [
[[package]]
name = "app_dirs"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "git+https://github.com/agersant/app-dirs-rs#8a0d107dee31183a78ae382c904e0fe70d7432b8"
dependencies = [
"ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1128,7 +1128,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66"
"checksum ape 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b419c2e36e91776200588f91e24c970d16d34236369136ca819f12dd903c5691"
"checksum app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7d1c0d48a81bbb13043847f957971f4d87c81542d80ece5e84ba3cba4058fd4"
"checksum app_dirs 1.1.1 (git+https://github.com/agersant/app-dirs-rs)" = "<none>"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bodyparser 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "07b171b407e583dc8f01011a713f20575a81ac60acecf3b8153012709aeb1fd6"
"checksum buf_redux 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b115bd9935c68b58f80ff867e1c46942c4aed79e78bcc8c2bc22d50f52bb9099"

View file

@ -8,7 +8,7 @@ ui = []
[dependencies]
ape = "0.1.2"
app_dirs = "1.1.1"
app_dirs = { git = "https://github.com/agersant/app-dirs-rs" }
getopts = "0.2.14"
hyper = "0.9.10"
id3 = { git = "https://github.com/jameshurst/rust-id3" }

View file

@ -2,7 +2,7 @@
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='Polaris' Id='33986EB1-E35C-4E01-817C-FA23F0C0FB88' UpgradeCode='9D86F109-E1EC-4C67-826C-8FB813838C49' Language='1033' Codepage='1252' Version='0.2.0' Manufacturer='Antoine Gersant'>
<Package Id='*' Keywords='Installer' Platform='x64' Description='Polaris Installer' Manufacturer='Antoine Gersant' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Package Id='*' Keywords='Installer' Platform='x64' InstallPrivileges='elevated' InstallScope='perMachine' Description='Polaris Installer' Manufacturer='Antoine Gersant' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Upgrade Id='9D86F109-E1EC-4C67-826C-8FB813838C49'>
<UpgradeVersion OnlyDetect='no' Property='OTHERFOUND' Minimum='0.1.0' IncludeMinimum='yes' Maximum='0.2.0' IncludeMaximum='no' />
@ -73,11 +73,12 @@
</Directory>
</Directory>
<Directory Id='AppDataFolder'>
<Directory Id='CommonAppDataFolder'>
<Directory Id='AppDataPolaris' Name='Polaris'>
<Component Id='ConfigFile' Guid='FAF6D040-CFA2-4C56-B5EB-C8A3054294E0'>
<RegistryValue Root='HKCU' Key='Software\Polaris' Name='ConfigFile' Type='string' Value='' KeyPath='yes' />
<File Source='polaris.toml'/>
<File Source='polaris.toml'>
<Permission GenericAll='yes' User='Everyone' />
</File>
<RemoveFolder Id='RemoveAppDataPolaris' Directory='AppDataPolaris' On='uninstall' />
</Component>
</Directory>

View file

@ -5,7 +5,7 @@ use std::fs;
use error::PError;
pub fn get_config_root() -> Result<PathBuf, PError> {
if let Ok(mut root) = data_root(AppDataType::UserConfig){
if let Ok(mut root) = data_root(AppDataType::SharedConfig){
root.push("Polaris");
return match fs::create_dir_all(&root) {
Ok(()) => Ok(root),
@ -16,7 +16,7 @@ pub fn get_config_root() -> Result<PathBuf, PError> {
}
pub fn get_cache_root() -> Result<PathBuf, PError> {
if let Ok(mut root) = data_root(AppDataType::UserCache){
if let Ok(mut root) = data_root(AppDataType::SharedData){
root.push("Polaris");
return match fs::create_dir_all(&root) {
Ok(()) => Ok(root),