MCPcopy Create free account
hub / github.com/elast0ny/shared_memory / get_tmp_dir

Function get_tmp_dir

src/windows.rs:118–132  ·  view source on GitHub ↗

Returns the path to a temporary directory in which to store files backing the shared memory. If it doesn't exist, the directory is created.

()

Source from the content-addressed store, hash-verified

116/// Returns the path to a temporary directory in which to store files backing the shared memory. If it
117/// doesn't exist, the directory is created.
118fn get_tmp_dir() -> Result<PathBuf, ShmemError> {
119 debug!("Getting & creating shared_memory-rs temp dir");
120 let mut path = std::env::temp_dir();
121 path.push("shared_memory-rs");
122
123 if path.is_dir() {
124 return Ok(path);
125 }
126
127 match std::fs::create_dir_all(path.as_path()) {
128 Ok(_) => Ok(path),
129 Err(e) if e.kind() == ErrorKind::AlreadyExists => Ok(path),
130 Err(e) => Err(ShmemError::UnknownOsError(e.raw_os_error().unwrap() as _)),
131 }
132}
133
134fn new_map(
135 unique_id: &str,

Callers 2

dropMethod · 0.85
new_mapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected