JFLib

plat/win_sys.rs (Windows)#

Source: lib/plat/win_sys.rs

win_sys -- Windows files, directories, environment, well-known paths, the date
                                        [src/plat/win/win_sys.s, win_files.s, plat_win.s]

Every function converts its paths into its own buffers, so all of them may run on any
thread.  File::read_at / write_at use explicit offsets (OVERLAPPED positions): several
threads may use one File at the same time.
  • fn dev_ino(_path: &str) -> Option<(u64, u64)> (device, inode) of a path: not used on Windows (every directory is visited)

  • fn env(name: &str) -> Option<String> the value of an environment variable [plat_env]

  • fn getenv(name: &str) -> Option<String> the same as env (ASMLIB's plat_getenv)

  • fn setenv(name: &str, value: Option<&str>) -> bool set (Some) or remove (None) an environment variable of this process [plat_setenv]

  • fn config_dir() -> Option<String> %APPDATA%, else %USERPROFILE%/AppData/Roaming; '/' separators, no trailing slash

  • fn data_dir() -> Option<String> %LOCALAPPDATA%, else %USERPROFILE%/AppData/Local; '/' separators, no trailing slash

  • fn cache_dir() -> Option<String> the same folder as data_dir: Windows keeps an app's cache below its local folder (vfs.rs: cache:// = <data_dir>/<app>/Cache)

  • fn temp_dir() -> Option<String> GetTempPathW in the same form as config_dir

  • fn cwd() -> String the current directory, native separators ("" on failure) [plat_cwd]

  • fn unix_time_ns() -> i64 wall-clock time: nanoseconds since 1970-01-01 00:00 UTC

  • fn date() -> (Date, bool) the local date and time; the flag is false (local time, not UTC) [plat_date]

Source: docs/API.md in the JFLib repository.