Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ edition = "2018"
authors = ["Einjerjar"]
description = "Simple alias implementation for windows using doskey"

[dependencies]
[dependencies]
dirs = "5.0"
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use std::fs;
use std::io::{Read, Write};
use std::process::Command;
use std::path::Path;
use dirs;

const CONFIG_PATH: &str = "cmd_alias";
const CONFIG_PATH: &str = "AppData\\Roaming\\cmd_alias";
const CONFIG_NAME: &str = "aliases.cmd";

fn main() -> Result<(), Box<dyn std::error::Error>>{
Expand All @@ -31,9 +32,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>>{
}
};

let config_root = Path::new("C:\\Users\\E\\AppData\\Roaming");
let home_dir = dirs::home_dir().expect("Failed to get home directory");

let config_root = config_root.join(CONFIG_PATH);
let config_root = home_dir.join(CONFIG_PATH);
let config_file = config_root.join(CONFIG_NAME);
let _ = fs::create_dir_all(&config_root).unwrap();

Expand Down