1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
crate::ix!();

/**
  | Sync directory contents. This is required
  | on some environments to ensure that
  | newly created files are committed to
  | disk.
  |
  */
#[cfg(not(WIN32))]
pub fn directory_commit(dirname: &Path)  {
    
    unsafe {

        let file: *mut libc::FILE = {

            let dirname = dirname.as_os_str().to_str().unwrap().as_ptr() as *const i8;

            libc::fopen(
                dirname,
                "r".as_ptr() as *const i8
            )
        };

        if file != null_mut() {
            libc::fsync(libc::fileno(file));
            libc::fclose(file);
        }
    }
}