mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-06-12 21:44:27 +02:00
fix(cli): create local appdata dir w/ quickstart
This commit ensures that the $Env:LOCALAPPDATA/komorebi dir is created by the quickstart command, as it cannot be assumed that this will always exist, especially on new machines with recent versions of Windows 11. fix #671
This commit is contained in:
@@ -44,15 +44,6 @@ running the following command in an Administrator Terminal before installing
|
|||||||
Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
|
Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
|
||||||
```
|
```
|
||||||
|
|
||||||
## Local data directory
|
|
||||||
|
|
||||||
If you are installing `komorebi` for the first time on a new machine, create a
|
|
||||||
dedicated folder for `komorebi` in `$Env:LOCALAPPDATA`.
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
mkdir "$Env:LOCALAPPDATA\komorebi" -ea 0
|
|
||||||
```
|
|
||||||
|
|
||||||
## Scoop
|
## Scoop
|
||||||
|
|
||||||
Make sure you have installed [`scoop`](https://scoop.sh) and verified that
|
Make sure you have installed [`scoop`](https://scoop.sh) and verified that
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ impl WindowsApi {
|
|||||||
}
|
}
|
||||||
.ok()
|
.ok()
|
||||||
{
|
{
|
||||||
Ok(_) => {}
|
Ok(()) => {}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
tracing::error!("enum_display_devices: {}", error);
|
tracing::error!("enum_display_devices: {}", error);
|
||||||
return Err(error.into());
|
return Err(error.into());
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ use crate::INITIAL_CONFIGURATION_LOADED;
|
|||||||
use crate::NO_TITLEBAR;
|
use crate::NO_TITLEBAR;
|
||||||
use crate::REMOVE_TITLEBARS;
|
use crate::REMOVE_TITLEBARS;
|
||||||
|
|
||||||
|
#[allow(clippy::struct_field_names)]
|
||||||
#[derive(Debug, Clone, Serialize, Getters, CopyGetters, MutGetters, Setters, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, Getters, CopyGetters, MutGetters, Setters, JsonSchema)]
|
||||||
pub struct Workspace {
|
pub struct Workspace {
|
||||||
#[getset(get = "pub", set = "pub")]
|
#[getset(get = "pub", set = "pub")]
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ use clap::ValueEnum;
|
|||||||
use color_eyre::eyre::anyhow;
|
use color_eyre::eyre::anyhow;
|
||||||
use color_eyre::eyre::bail;
|
use color_eyre::eyre::bail;
|
||||||
use color_eyre::Result;
|
use color_eyre::Result;
|
||||||
|
use dirs::data_local_dir;
|
||||||
use fs_tail::TailedFile;
|
use fs_tail::TailedFile;
|
||||||
use heck::ToKebabCase;
|
use heck::ToKebabCase;
|
||||||
use komorebi_core::resolve_home_path;
|
use komorebi_core::resolve_home_path;
|
||||||
@@ -1247,7 +1248,10 @@ fn main() -> Result<()> {
|
|||||||
|
|
||||||
let home_dir = dirs::home_dir().expect("could not find home dir");
|
let home_dir = dirs::home_dir().expect("could not find home dir");
|
||||||
let config_dir = home_dir.join(".config");
|
let config_dir = home_dir.join(".config");
|
||||||
|
let local_appdata_dir = data_local_dir().expect("could not find localdata dir");
|
||||||
|
let data_dir = local_appdata_dir.join("komorebi");
|
||||||
std::fs::create_dir_all(&config_dir)?;
|
std::fs::create_dir_all(&config_dir)?;
|
||||||
|
std::fs::create_dir_all(data_dir)?;
|
||||||
|
|
||||||
let komorebi_json = reqwest::blocking::get(
|
let komorebi_json = reqwest::blocking::get(
|
||||||
format!("https://raw.githubusercontent.com/LGUG2Z/komorebi/v{version}/komorebi.example.json")
|
format!("https://raw.githubusercontent.com/LGUG2Z/komorebi/v{version}/komorebi.example.json")
|
||||||
@@ -1438,7 +1442,7 @@ fn main() -> Result<()> {
|
|||||||
let color_log = std::env::temp_dir().join("komorebi.log");
|
let color_log = std::env::temp_dir().join("komorebi.log");
|
||||||
let file = TailedFile::new(File::open(color_log)?);
|
let file = TailedFile::new(File::open(color_log)?);
|
||||||
let locked = file.lock();
|
let locked = file.lock();
|
||||||
#[allow(clippy::significant_drop_in_scrutinee)]
|
#[allow(clippy::significant_drop_in_scrutinee, clippy::lines_filter_map_ok)]
|
||||||
for line in locked.lines().flatten() {
|
for line in locked.lines().flatten() {
|
||||||
println!("{line}");
|
println!("{line}");
|
||||||
}
|
}
|
||||||
@@ -1735,7 +1739,7 @@ fn main() -> Result<()> {
|
|||||||
let exec = if let Ok(output) = Command::new("where.exe").arg("komorebi.ps1").output() {
|
let exec = if let Ok(output) = Command::new("where.exe").arg("komorebi.ps1").output() {
|
||||||
let stdout = String::from_utf8(output.stdout)?;
|
let stdout = String::from_utf8(output.stdout)?;
|
||||||
match stdout.trim() {
|
match stdout.trim() {
|
||||||
stdout if stdout.is_empty() => None,
|
"" => None,
|
||||||
// It's possible that a komorebi.ps1 config will be in %USERPROFILE% - ignore this
|
// It's possible that a komorebi.ps1 config will be in %USERPROFILE% - ignore this
|
||||||
stdout if !stdout.contains("scoop") => None,
|
stdout if !stdout.contains("scoop") => None,
|
||||||
stdout => {
|
stdout => {
|
||||||
|
|||||||
Reference in New Issue
Block a user