use namespaced path instead of local path

This commit is contained in:
Evan Almloff committed 2023-02-23 12:05:17 -06:00
1 parent f664ce8fe0
commit 2c629f6d13
1 file changed
+2 -4
+2 -4
View File
@@ -139,7 +139,6 @@ pub fn init<Ctx: HotReloadingContext + Send + 'static>(cfg: Config<Ctx>) {
.map(|path| crate_dir.join(PathBuf::from(path))) .map(|path| crate_dir.join(PathBuf::from(path)))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let temp_file = std::env::temp_dir().join("@dioxusin");
let channels = Arc::new(Mutex::new(Vec::new())); let channels = Arc::new(Mutex::new(Vec::new()));
let FileMapBuildResult { let FileMapBuildResult {
map: file_map, map: file_map,
@@ -160,7 +159,7 @@ pub fn init<Ctx: HotReloadingContext + Send + 'static>(cfg: Config<Ctx>) {
} }
let file_map = Arc::new(Mutex::new(file_map)); let file_map = Arc::new(Mutex::new(file_map));
if let Ok(local_socket_stream) = LocalSocketListener::bind(temp_file.as_path()) { if let Ok(local_socket_stream) = LocalSocketListener::bind("@dioxusin") {
let aborted = Arc::new(Mutex::new(false)); let aborted = Arc::new(Mutex::new(false));
// listen for connections // listen for connections
@@ -348,8 +347,7 @@ fn send_msg(msg: HotReloadMsg, channel: &mut impl Write) -> bool {
/// Connect to the hot reloading listener. The callback provided will be called every time a template change is detected /// Connect to the hot reloading listener. The callback provided will be called every time a template change is detected
pub fn connect(mut f: impl FnMut(HotReloadMsg) + Send + 'static) { pub fn connect(mut f: impl FnMut(HotReloadMsg) + Send + 'static) {
std::thread::spawn(move || { std::thread::spawn(move || {
let temp_file = std::env::temp_dir().join("@dioxusin"); if let Ok(socket) = LocalSocketStream::connect("@dioxusin") {
if let Ok(socket) = LocalSocketStream::connect(temp_file.as_path()) {
let mut buf_reader = BufReader::new(socket); let mut buf_reader = BufReader::new(socket);
loop { loop {
let mut buf = String::new(); let mut buf = String::new();