aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@gmail.com>2019-09-10 20:57:55 -0300
committerMatias Linares <matiaslina@gmail.com>2019-09-10 20:57:55 -0300
commit0763564eedc459a98e63a65f7ffee8ad37100fe7 (patch)
treed6df96cc98f27c1f7a0eaa4a99d62b5c15552f7c /src
parenta865776fb4c44f145832b04a4088d006fd8cba3d (diff)
downloaddotwm-0763564eedc459a98e63a65f7ffee8ad37100fe7.tar.gz
use dirs crate
Diffstat (limited to 'src')
-rw-r--r--src/main.rs25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs
index b0b5b9b..fab737a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,6 +8,7 @@ extern crate libc;
extern crate x11;
#[macro_use]
extern crate lazy_static;
+extern crate dirs;
pub mod safe_x11;
pub mod command;
@@ -16,29 +17,26 @@ pub mod event;
pub mod socket;
pub mod desktop;
-use dotwm::DotWM;
-use command::*;
-use event::{Event,select_event};
-use socket::parser;
-
use std::collections::HashMap;
use std::mem::uninitialized;
-
-use x11::xlib;
-use x11::keysym;
-
use std::fs;
-use std::env;
use std::path::{PathBuf};
use std::io::{Read,Write};
use std::os::unix::net::UnixListener;
+use x11::xlib;
+use x11::keysym;
+
+use dotwm::DotWM;
+use command::*;
+use event::{Event,select_event};
+use socket::parser;
+
fn dotwm_dir() -> PathBuf {
- let mut path = env::home_dir().unwrap();
- path.push(".config");
+ let mut path = dirs::config_dir().unwrap();
path.push("dotwm");
-
if !path.exists() && !path.is_dir() {
+ println!("Creating config directory in {:?}", path);
fs::create_dir(&path).unwrap();
}
@@ -55,6 +53,7 @@ fn run_autostart() {
let mut autostart = dotwm_dir();
autostart.push("autostart");
+ println!("Trying to exec {:?}", autostart);
let found = exec_cmd(autostart, &[]).is_ok();
if !found {