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

Initial try at a Mac implementation #1

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

zetashift
Copy link

The implementation is 99% based off of dirs-rs package! :P

@zetashift zetashift marked this pull request as ready for review January 12, 2023 01:27
@zetashift
Copy link
Author

How do I test my code, running sbt test brings me the following error:

[error] /Users/zeta/dev/scala/dirs/core/shared/src/main/scala/tf/bug/dirs/Dirs.scala:14:31: not found: value WindowsPlatform
[error]   lazy val windows: Windows = WindowsPlatform
[error]                               ^
[error] /Users/zeta/dev/scala/dirs/core/shared/src/main/scala/tf/bug/dirs/Dirs.scala:15:23: not found: value MacPlatform
[error]   lazy val mac: Mac = MacPlatform
[error]                       ^
[error] two errors found
[error] /Users/zeta/dev/scala/dirs/core/shared/src/main/scala/tf/bug/dirs/Dirs.scala:14:31: not found: value WindowsPlatform
[error]   lazy val windows: Windows = WindowsPlatform
[error]                               ^
[error] one error found

@s5bug
Copy link
Owner

s5bug commented Jan 12, 2023

I don't actually have a unit test framework set up, that test module is really just an executable.

I think you specifically have to run it on the platform you're targeting.

(Really, it should end up being removed, or moved to the shared section of a demo crossproject. test/ is just the easiest way for me to throw something together in IntelliJ, and I never really should have pushed it...)

val osName = System.getProperty("os.name")
if (osName.contains("Windows")) {
Platform.Windows
} else {
Copy link
Owner

Choose a reason for hiding this comment

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

contains("Mac") || contains("Darwin")? Not sure if darwin will report lower-case here though...

Copy link
Author

Choose a reason for hiding this comment

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

I got the "Mac" part by runninggetProperty locally.
AFAIK, os.name never returns "darwin". However only evidence I can find is are blogposts.

@s5bug
Copy link
Owner

s5bug commented Jan 19, 2023

Looks great! Once I figure out how to run only specific targets (so we don't have to worry about Native yet), if it works I'll merge.

@zetashift
Copy link
Author

zetashift commented Jan 19, 2023

Thank you! I'll add Linux when I have access to a Linux box again.

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.

2 participants