Make windows config location more sensible
This commit is contained in:
parent
f0180430df
commit
6d7647c890
|
@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- New configuration field `visual_bell.color` allows changing the visual bell color
|
- New configuration field `visual_bell.color` allows changing the visual bell color
|
||||||
- Crashes on Windows are now also reported with a popup in addition to stderr
|
- Crashes on Windows are now also reported with a popup in addition to stderr
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Windows configuration location has been moved from %USERPROFILE\alacritty.yml
|
||||||
|
to %APPDATA%\Roaming\alacritty\alacritty.yml
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix color issue in ncurses programs by updating terminfo pairs from 0x10000 to 0x7FFF
|
- Fix color issue in ncurses programs by updating terminfo pairs from 0x10000 to 0x7FFF
|
||||||
|
|
|
@ -60,6 +60,7 @@ winpty = { path = "./winpty" }
|
||||||
mio-named-pipes = "0.1"
|
mio-named-pipes = "0.1"
|
||||||
winapi = { version = "0.3.5", features = ["winuser", "synchapi", "roerrorapi", "winerror"]}
|
winapi = { version = "0.3.5", features = ["winuser", "synchapi", "roerrorapi", "winerror"]}
|
||||||
dunce = "0.1"
|
dunce = "0.1"
|
||||||
|
dirs = "1.0"
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
objc = "0.2.2"
|
objc = "0.2.2"
|
||||||
|
|
|
@ -126,7 +126,7 @@ file, please consult the comments in the default config file.
|
||||||
|
|
||||||
On Windows the config file is located at:
|
On Windows the config file is located at:
|
||||||
|
|
||||||
`%UserProfile%\alacritty.yml`
|
`%APPDATA%\Roaming\alacritty\alacritty.yml`
|
||||||
|
|
||||||
## Issues (known, unknown, feature requests, etc.)
|
## Issues (known, unknown, feature requests, etc.)
|
||||||
|
|
||||||
|
|
|
@ -1521,33 +1521,52 @@ impl Config {
|
||||||
.map(|path| path.into())
|
.map(|path| path.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove old configuration location warning (Deprecated 03/12/2018)
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub fn installed_config<'a>() -> Option<Cow<'a, Path>> {
|
pub fn installed_config<'a>() -> Option<Cow<'a, Path>> {
|
||||||
if let Some(mut path) = ::std::env::home_dir() {
|
let old = dirs::home_dir()
|
||||||
path.push("alacritty");
|
.map(|path| path.join("alacritty.yml"));
|
||||||
path.set_extension("yml");
|
let new = dirs::config_dir()
|
||||||
if path.exists() {
|
.map(|path| path.join("alacritty\\alacritty.yml"));
|
||||||
return Some(path.into());
|
|
||||||
}
|
if let Some(old_path) = old.as_ref().filter(|old| old.exists()) {
|
||||||
|
warn!(
|
||||||
|
"Found configuration at: '{}'. The file should be moved to the new location: '{}'.",
|
||||||
|
old_path.to_string_lossy(),
|
||||||
|
new.as_ref().map(|new| new.to_string_lossy()).unwrap(),
|
||||||
|
);
|
||||||
|
|
||||||
|
old.map(Cow::from)
|
||||||
|
} else {
|
||||||
|
new.filter(|new| new.exists()).map(Cow::from)
|
||||||
}
|
}
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
pub fn write_defaults() -> io::Result<Cow<'static, Path>> {
|
pub fn write_defaults() -> io::Result<Cow<'static, Path>> {
|
||||||
let path = ::xdg::BaseDirectories::with_prefix("alacritty")
|
let path = xdg::BaseDirectories::with_prefix("alacritty")
|
||||||
.map_err(|err| io::Error::new(io::ErrorKind::NotFound, ::std::error::Error::description(&err)))
|
.map_err(|err| io::Error::new(io::ErrorKind::NotFound, err.to_string().as_str()))
|
||||||
.and_then(|p| p.place_config_file("alacritty.yml"))?;
|
.and_then(|p| p.place_config_file("alacritty.yml"))?;
|
||||||
|
|
||||||
File::create(&path)?.write_all(DEFAULT_ALACRITTY_CONFIG.as_bytes())?;
|
File::create(&path)?.write_all(DEFAULT_ALACRITTY_CONFIG.as_bytes())?;
|
||||||
|
|
||||||
Ok(path.into())
|
Ok(path.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub fn write_defaults() -> io::Result<Cow<'static, Path>> {
|
pub fn write_defaults() -> io::Result<Cow<'static, Path>> {
|
||||||
let path = ::std::env::home_dir()
|
let mut path = dirs::config_dir()
|
||||||
.ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, "could not find profile directory"))
|
.ok_or_else(|| {
|
||||||
.and_then(|mut p| {p.push("alacritty"); p.set_extension("yml"); Ok(p)})?;
|
io::Error::new(io::ErrorKind::NotFound, "could not find profile directory")
|
||||||
|
}
|
||||||
|
)?;
|
||||||
|
|
||||||
|
path = path.join("alacritty/alacritty.yml");
|
||||||
|
|
||||||
|
fs::create_dir_all(path.parent().unwrap())?;
|
||||||
|
|
||||||
File::create(&path)?.write_all(DEFAULT_ALACRITTY_CONFIG.as_bytes())?;
|
File::create(&path)?.write_all(DEFAULT_ALACRITTY_CONFIG.as_bytes())?;
|
||||||
|
|
||||||
Ok(path.into())
|
Ok(path.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ extern crate winpty;
|
||||||
extern crate dunce;
|
extern crate dunce;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
extern crate image;
|
extern crate image;
|
||||||
|
#[cfg(windows)]
|
||||||
|
extern crate dirs;
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
Loading…
Reference in New Issue