aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHenil <71698300+henil@users.noreply.github.com>2020-11-21 22:02:46 +0530
committerGitHub <noreply@github.com>2020-11-21 17:32:46 +0100
commit6a9ecc42a8ed5a0874be0eda7cc815a1cc3f5df0 (patch)
tree1aa06e5d5a9cad4962c038ce18a945d812be808f /src
parentfeat(ux): add a command mode (#42) (diff)
downloadsl0ppij-6a9ecc42a8ed5a0874be0eda7cc815a1cc3f5df0.tar.gz
sl0ppij-6a9ecc42a8ed5a0874be0eda7cc815a1cc3f5df0.tar.xz
sl0ppij-6a9ecc42a8ed5a0874be0eda7cc815a1cc3f5df0.zip
refactor(structure): Change structure of `/tmp` directory (#62)
Co-authored-by: Aram Drevekenin <aram@poor.dev>
Diffstat (limited to 'src')
-rw-r--r--src/input.rs2
-rw-r--r--src/main.rs14
-rw-r--r--src/utils/consts.rs6
3 files changed, 11 insertions, 11 deletions
diff --git a/src/input.rs b/src/input.rs
index 976ef71d..8ae604c2 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -95,7 +95,7 @@ impl InputHandler {
self.stdin
.read(&mut self.buffer)
.expect("failed to read stdin");
- // uncomment this to print the entered character to a log file (/tmp/mosaic-log.txt) for debugging
+ // uncomment this to print the entered character to a log file (/tmp/mosaic/mosaic-log.txt) for debugging
// debug_log_to_file(format!("buffer {:?}", self.buffer));
match self.buffer {
[7, 0, 0, 0, 0, 0, 0, 0, 0, 0] => {
diff --git a/src/main.rs b/src/main.rs
index 10ee87c1..683874f4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -27,7 +27,7 @@ use crate::layout::Layout;
use crate::os_input_output::{get_os_input, OsApi};
use crate::pty_bus::{PtyBus, PtyInstruction, VteEvent};
use crate::screen::{Screen, ScreenInstruction};
-use crate::utils::{consts::MOSAIC_TMP_FOLDER, logging::*};
+use crate::utils::{consts::MOSAIC_IPC_PIPE, logging::*};
#[derive(Serialize, Deserialize, Debug)]
enum ApiCommand {
@@ -64,23 +64,23 @@ pub fn main() {
if opts.split.is_some() {
match opts.split {
Some('h') => {
- let mut stream = UnixStream::connect(MOSAIC_TMP_FOLDER).unwrap();
+ let mut stream = UnixStream::connect(MOSAIC_IPC_PIPE).unwrap();
let api_command = bincode::serialize(&ApiCommand::SplitHorizontally).unwrap();
stream.write_all(&api_command).unwrap();
}
Some('v') => {
- let mut stream = UnixStream::connect(MOSAIC_TMP_FOLDER).unwrap();
+ let mut stream = UnixStream::connect(MOSAIC_IPC_PIPE).unwrap();
let api_command = bincode::serialize(&ApiCommand::SplitVertically).unwrap();
stream.write_all(&api_command).unwrap();
}
_ => {}
};
} else if opts.move_focus {
- let mut stream = UnixStream::connect(MOSAIC_TMP_FOLDER).unwrap();
+ let mut stream = UnixStream::connect(MOSAIC_IPC_PIPE).unwrap();
let api_command = bincode::serialize(&ApiCommand::MoveFocus).unwrap();
stream.write_all(&api_command).unwrap();
} else if opts.open_file.is_some() {
- let mut stream = UnixStream::connect(MOSAIC_TMP_FOLDER).unwrap();
+ let mut stream = UnixStream::connect(MOSAIC_IPC_PIPE).unwrap();
let file_to_open = opts.open_file.unwrap();
let api_command = bincode::serialize(&ApiCommand::OpenFile(file_to_open)).unwrap();
stream.write_all(&api_command).unwrap();
@@ -273,8 +273,8 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: Opt) {
let send_pty_instructions = send_pty_instructions.clone();
let send_screen_instructions = send_screen_instructions.clone();
move || {
- ::std::fs::remove_file("/tmp/mosaic").ok();
- let listener = ::std::os::unix::net::UnixListener::bind("/tmp/mosaic")
+ std::fs::remove_file(MOSAIC_IPC_PIPE).ok();
+ let listener = std::os::unix::net::UnixListener::bind(MOSAIC_IPC_PIPE)
.expect("could not listen on ipc socket");
for stream in listener.incoming() {
diff --git a/src/utils/consts.rs b/src/utils/consts.rs
index 5eb96c67..e0a6da9f 100644
--- a/src/utils/consts.rs
+++ b/src/utils/consts.rs
@@ -1,3 +1,3 @@
-pub const MOSAIC_TMP_LOG_FILE: &str = "/tmp/mosaic-log.txt";
-pub const MOSAIC_TMP_LOG_DIR: &str = "/tmp/mosaic-log";
-pub const MOSAIC_TMP_FOLDER: &str = "/tmp/mosaic";
+pub const MOSAIC_TMP_LOG_FILE: &str = "/tmp/mosaic/mosaic-log/log.txt";
+pub const MOSAIC_TMP_LOG_DIR: &str = "/tmp/mosaic/mosaic-log";
+pub const MOSAIC_IPC_PIPE: &str = "/tmp/mosaic/ipc";