refactor(structure): Change structure of /tmp directory (#62)
Co-authored-by: Aram Drevekenin <aram@poor.dev>
This commit is contained in:
parent
11e72b3d6b
commit
6a9ecc42a8
3 changed files with 11 additions and 11 deletions
|
|
@ -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] => {
|
||||
|
|
|
|||
14
src/main.rs
14
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() {
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue