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

fix init project exception on windows #17

Closed
wants to merge 3 commits into from

Conversation

corkine
Copy link

@corkine corkine commented Apr 16, 2022

On Windows, the default environment variable is Path instead of PATH, so the execute function has a null pointer problem here.

In addition, the bin directory in the sdk distributed by flutter contains two programs, dart and dart.bat, in which the execute function will incorrectly find dart (not a valid Win32 program under Windows).

@corkine corkine requested review from cgrand and dupuchba as code owners April 16, 2022 09:04
@cgrand
Copy link
Contributor

cgrand commented Apr 16, 2022

First of all: thanks! Could you change it so as to first test if (System/getProperty “os.name”) starts by Windows and then use different envvars and bin for windows?

@corkine
Copy link
Author

corkine commented Apr 16, 2022

First of all: thanks! Could you change it so as to first test if (System/getProperty “os.name”) starts by Windows and then use different envvars and bin for windows?

ok, I change the code to use dynamic var bind.

config (if (.exists f)
(with-open [rdr (-> f io/reader java.io.PushbackReader.)]
(edn/read rdr))
{})]
(binding [*ansi* (and (System/console) (get (System/getenv) "TERM"))
*dart* (if is-windows? "dart.bat" *dart*)
Copy link

Choose a reason for hiding this comment

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

Note: I installed Dart using the official instructions on https://dart.dev/get-dart, and instead of "dart.bat" I have "dart.exe"

Copy link
Author

Choose a reason for hiding this comment

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

The separately installed dart sdk does contain an entry for dart.exe, but the dart sdk provided by flutter executes the FLUTTER_PATH\bin\cache\dart-sdk\bin\dart.exe program through the dart.bat script.

In the command line, the dart command always works, but in the code, I need to delete the wrong dart binary under flutter/bin and add the dart sdk to the PATH before I can use dart.exe to find dart, which Not user friendly either.

Maybe look in the code for dart.exe (from Dart users) and dart.bat (from Flutter users) and find one of them.

Copy link

@vlaaad vlaaad Apr 18, 2022

Choose a reason for hiding this comment

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

I would expect cljd to work without flutter installed? I don't have flutter, hence I don't have dart.bat, only dart.exe...

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.

3 participants