Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement getSearchPath #250

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Implement getSearchPath #250

wants to merge 1 commit into from

Conversation

hasufell
Copy link
Member

@hasufell hasufell commented Mar 6, 2025

Fixes #249

@hasufell hasufell force-pushed the issue-249 branch 8 times, most recently from 8106870 to f88c411 Compare March 6, 2025 13:16
@hasufell
Copy link
Member Author

hasufell commented Mar 6, 2025

@joeyh can you test this?

@hasufell
Copy link
Member Author

hasufell commented Mar 6, 2025

The amount of code inlining here is outrageous.

Maybe we need to implement this function somewhere else.


-- | Get a list of 'FILEPATH's in the $PATH variable.
getSearchPath :: IO [OsPath]
#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At line 1507 we checked whether WINDOWS is defined, presumably in our branch it isn't so is there any need to consider mingw32 platform here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this function will only be visible in the System.OsPath module for the current platform. It will not be present in either System.OsPath.Posix nor System.OsPath.Windows.

Still it seems in such case it may be permissible for filepath to depend on the Win32 package and reuse its environment handling functions.

@@ -1467,3 +1504,137 @@ decodeFS (OsString (PosixString x)) = decodeWithBasePosix x

#endif

#ifdef WINDOWS
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like sometimes it's checked as #ifdef WINDOWS and other times the check looks like #if defined(WINDOWS). I suggest to unify everything to #if defined(WINDOWS) style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add System.OsPath.getSearchPath
2 participants