Extract paths out of util (#13182)

This PR extracts the definition of the various Zed paths out of `util`
and into a new `paths` crate.

`util` is for generic utils, while these paths are Zed-specific. For
instance, `gpui` depends on `util`, and it shouldn't have knowledge of
these paths, since they are only used by Zed.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-06-17 19:27:42 -04:00 committed by GitHub
parent 78e0f71a28
commit 258a8a37d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 208 additions and 151 deletions

View file

@ -40,7 +40,7 @@ use std::{
sync::Arc,
};
use theme::{ActiveTheme, SystemAppearance, ThemeRegistry, ThemeSettings};
use util::{maybe, parse_env_output, paths, with_clone, ResultExt, TryFutureExt};
use util::{maybe, parse_env_output, with_clone, ResultExt, TryFutureExt};
use uuid::Uuid;
use welcome::{show_welcome_view, BaseKeymap, FIRST_OPEN};
use workspace::{AppState, WorkspaceSettings, WorkspaceStore};
@ -668,12 +668,12 @@ async fn restore_or_create_workspace(
fn init_paths() -> anyhow::Result<()> {
for path in [
&*util::paths::CONFIG_DIR,
&*util::paths::EXTENSIONS_DIR,
&*util::paths::LANGUAGES_DIR,
&*util::paths::DB_DIR,
&*util::paths::LOGS_DIR,
&*util::paths::TEMP_DIR,
&*paths::CONFIG_DIR,
&*paths::EXTENSIONS_DIR,
&*paths::LANGUAGES_DIR,
&*paths::DB_DIR,
&*paths::LOGS_DIR,
&*paths::TEMP_DIR,
]
.iter()
{

View file

@ -22,7 +22,7 @@ use std::{io::Write, panic, sync::atomic::AtomicU32, thread};
use telemetry_events::LocationData;
use telemetry_events::Panic;
use telemetry_events::PanicRequest;
use util::{paths, ResultExt};
use util::ResultExt;
use crate::stdout_is_a_pty;
static PANIC_COUNT: AtomicU32 = AtomicU32::new(0);

View file

@ -36,12 +36,9 @@ use task::static_source::{StaticSource, TrackedFile};
use theme::ActiveTheme;
use workspace::notifications::NotificationId;
use paths::{LOCAL_SETTINGS_RELATIVE_PATH, LOCAL_TASKS_RELATIVE_PATH};
use terminal_view::terminal_panel::{self, TerminalPanel};
use util::{
asset_str,
paths::{self, LOCAL_SETTINGS_RELATIVE_PATH, LOCAL_TASKS_RELATIVE_PATH},
ResultExt,
};
use util::{asset_str, ResultExt};
use uuid::Uuid;
use vim::VimModeSetting;
use welcome::BaseKeymap;

View file

@ -113,7 +113,6 @@ impl OpenListener {
pub fn listen_for_cli_connections(opener: OpenListener) -> Result<()> {
use release_channel::RELEASE_CHANNEL_NAME;
use std::os::unix::net::UnixDatagram;
use util::paths;
let sock_path = paths::SUPPORT_DIR.join(format!("zed-{}.sock", *RELEASE_CHANNEL_NAME));
// remove the socket if the process listening on it has died