Commit cf08c688 authored by Stavros Korokithakis's avatar Stavros Korokithakis

Merge branch 'tcyrus-patch-1' into 'master'

Switch from xdg to directories crate

See merge request !2
parents f6fd542b aaec5e21
Pipeline #135556024 passed with stage
in 5 minutes and 10 seconds
This diff is collapsed.
......@@ -5,12 +5,11 @@ authors = ["Stavros Korokithakis <[email protected]>"]
[dependencies]
clap = "^2.30"
dirs = "^2"
lazy_static = "^1"
directories = "^2.0.2"
lazy_static = "1.4.0"
log = "^0.4"
notify = "^4.0"
reqwest = "^0"
rouille = "^3"
rustc-serialize = "^0.3"
reqwest = { version = "0.10.4", features = ["json"] }
rouille = "3.0.0"
serde = { version = "1.0.106", features = ["derive"] }
simple_logger = "^1"
xdg = "^2.1"
#[macro_use]
extern crate clap;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
extern crate dirs;
#[macro_use] extern crate clap;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate log;
extern crate directories;
extern crate notify;
extern crate reqwest;
#[macro_use]
extern crate rouille;
extern crate rustc_serialize;
extern crate serde;
#[macro_use] extern crate rouille;
extern crate simple_logger;
extern crate xdg;
mod views;
use directories::{BaseDirs, ProjectDirs};
use log::Level;
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
use std::collections::HashMap;
......@@ -49,19 +45,20 @@ lazy_static! {
lazy_static! {
static ref HEARTH_DIR: std::path::PathBuf = {
let mut dir = dirs::home_dir().expect("Could not get home directory.");
dir.push("Hearth");
dir
let base_dirs = BaseDirs::new()
.expect("Could not get home directory.");
base_dirs.home_dir().join("Hearth")
};
}
lazy_static! {
static ref IPFS_PATH: std::path::PathBuf = {
let xdg_dirs = xdg::BaseDirectories::with_prefix("hearth")
let proj_dirs = ProjectDirs::from("io", "eternum", "hearth")
.expect("Could not retrieve config directory path.");
xdg_dirs
.create_config_directory("ipfs")
.expect("Could not create IPFS config directory.")
let ipfs_dir = proj_dirs.config_dir().join("ipfs");
fs::create_dir_all(ipfs_dir.as_path())
.expect("Could not create IPFS config directory.");
ipfs_dir
};
}
......
use rouille;
use rouille::Response;
use rouille::{self, Response};
use serde::Serialize;
use kill_ipfs_and_exit;
use HTTP_INTERFACE;
use IPFS_HASHES;
#[derive(RustcEncodable)]
#[derive(Serialize)]
struct ExitResponse {
result: String,
}
#[derive(RustcEncodable)]
#[derive(Serialize)]
struct HashResponse {
result: String,
hash: String,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment