(src: &OsPath, dst: &OsPath)
| 158 | static HAS_UNPRIVILEGED_FLAG: AtomicBool = AtomicBool::new(true); |
| 159 | |
| 160 | fn check_dir(src: &OsPath, dst: &OsPath) -> bool { |
| 161 | use windows_sys::Win32::Storage::FileSystem::GetFileExInfoStandard; |
| 162 | |
| 163 | let dst_parent = dst.as_path().parent(); |
| 164 | let Some(dst_parent) = dst_parent else { |
| 165 | return false; |
| 166 | }; |
| 167 | let resolved = if src.as_path().is_absolute() { |
| 168 | src.as_path().to_path_buf() |
| 169 | } else { |
| 170 | dst_parent.join(src.as_path()) |
| 171 | }; |
| 172 | let wide = match widestring::WideCString::from_os_str(&resolved) { |
| 173 | Ok(wide) => wide, |
| 174 | Err(_) => return false, |
| 175 | }; |
| 176 | let mut info: WIN32_FILE_ATTRIBUTE_DATA = unsafe { core::mem::zeroed() }; |
| 177 | let ok = unsafe { |
| 178 | GetFileAttributesExW( |
| 179 | wide.as_ptr(), |
| 180 | GetFileExInfoStandard, |
| 181 | &mut info as *mut _ as *mut _, |
| 182 | ) |
| 183 | }; |
| 184 | ok != 0 && (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0 |
| 185 | } |
| 186 | |
| 187 | let mut flags = 0u32; |
| 188 | if HAS_UNPRIVILEGED_FLAG.load(Ordering::Relaxed) { |
no test coverage detected