Reputation: 539
The directory
library contains many helper methods for getting certain reserved directories. However, as of the latest version (1.2.3.1), there does not appear to be a function that can get the system OS directory; e.g., "C:\Windows". I'd expect this to be a function like getSystemDirectory
, but I don't see any equivalent. At least on Windows, it is possible for a user to install the OS to a non-standard location, therefore, it's not safe to make any assumptions as to its location.
Is there another library that exposes a function like this?
Upvotes: 1
Views: 166
Reputation: 64740
The correct way to find OS specific operations is to tell hoogle which operating system you're talking about. Hopefully it is obvious when one is looking for something OS specific. In this case you get success with the straight-forward os:windows system directory
.
Upvotes: 1
Reputation: 539
The Win32
library contains this functionality.
import System.Win32.Info
-- Calls Win32's GetWindowsDirectory() function in kernel32.dll
-- Corresponds to: C:\Windows
getWindowsDirectory :: IO String
-- Calls Win32's GetSystemDirectory() function in kernel32.dll
-- Corresponds to: C:\Windows\system32
getSystemDirectory :: IO String
Upvotes: 4