Code Monkey home page Code Monkey logo

Comments (17)

sagiegurari avatar sagiegurari commented on August 17, 2024 2

i suddenly remembered something about mkdir on windows.... the reason you cant run commands like mkdir on windows, is because its an internal cmd command and not a standalone executable.
meaning, it only works when inside a windows shell environment.

duckscript is indeed the way to go forward since it provides a real cross platform api.

from bevy_game_template.

rgripper avatar rgripper commented on August 17, 2024 1

I ran it outside of the scripts 😀 I'll do a clean download of your template and try everything again.

from bevy_game_template.

will-hart avatar will-hart commented on August 17, 2024 1

Same error for me on Win10 running Windows Terminal/Powershell/Starship prompt. I've tried

[tasks.create-build-dir]
args = ["./build/web/target"]
command = "mkdir"

and

[tasks.create-build-dir]
args = ["-p", "./build/web/target"]
command = "mkdir"

Running either mkdir command directly from the command line in the project root creates the folders as expected. I can skip this step by manually creating the folder and adding

[tasks.create-build-dir]
ignore_errors = true
# ...

But then I get a "file not found" error on copying the wasm file to the target directory.

I've also tried

[tasks.echo-path]
command = "echo"
args = ["${CARGO_MAKE_WORKING_DIRECTORY}/build/web/target"]

[tasks.create-build-dir]
args = ["-p", "${CARGO_MAKE_WORKING_DIRECTORY}/build/web/target"]
command = "mkdir"
dependencies = ["echo-path"]

The correct path is printed but the create-build-dir task still fails. Replacing /build/web/target with \\build\\web\\target also fails.

This works though

[tasks.create-build-dir]
script_runner = "@duckscript"
script = [
'''
p = canonicalize "build/web/target"
mkdir ${p}
''']

from bevy_game_template.

rgripper avatar rgripper commented on August 17, 2024 1

Hey @NiklasEi, I emailed you recently, not sure if you mind.

from bevy_game_template.

will-hart avatar will-hart commented on August 17, 2024 1

It seems there are some weird path things on windows. I had to replace all the cp and mv commands with this before it worked.

[tasks.copy-files-for-release]
script_runner = "@duckscript"
script = [
'''
target = set "./build/web/target"
web = set "./build/web"
windows = set "./build/windows"

echo "Creating ${target}"
rm -r ${web}
mkdir ${target}

echo "Copying ${windows}/icon.ico to ${web}/icon.ico"
cp ${windows}/icon.ico ${web}/icon.ico
echo "Moving ${web}/icon.ico to ${web}/favicon.ico"
mv ${web}/icon.ico ${web}/favicon.ico

echo "Copying ${TARGET_DIR}${CARGO_MAKE_CRATE_NAME}.wasm to ${target}"
cp ${TARGET_DIR}${CARGO_MAKE_CRATE_NAME}.wasm ${target}/${CARGO_MAKE_CRATE_NAME}.wasm

echo "Copying ${TARGET_DIR}wasm.js to ${target}"
cp ${TARGET_DIR}wasm.js ${target}/wasm.js

echo "Copying ${TARGET_DIR}wasm_bg.wasm to ${target}"
cp ${TARGET_DIR}wasm_bg.wasm ${target}/wasm_bg.wasm

echo "Copying ./index.html to ${web}"
cp ./index.html ${web}/index.html

echo "Copying ./assets to ${web}"
cp ./assets ${web}

echo "Copying ./credits to ${web}"
cp ./credits ${web}
''']

from bevy_game_template.

NiklasEi avatar NiklasEi commented on August 17, 2024 1

Resolved using the script @will-hart proposed

from bevy_game_template.

NiklasEi avatar NiklasEi commented on August 17, 2024

Hey, thanks for raising the issue.
I am currently settign up my windows PC to be able to test this myself, but it looks like the mkdir command just needs to be different for Windows.

from bevy_game_template.

rgripper avatar rgripper commented on August 17, 2024

I tried to run the command separately and it didn't complain. Thanks for helping out!

from bevy_game_template.

NiklasEi avatar NiklasEi commented on August 17, 2024

I finally finished setting up my Windows machine. In my case the command worked out of the box. I have very little experience with commands on Windows, so I am not sure how to change it to be more compatible.

I tried to run the command separately and it didn't complain.

Do you mean you ran the mkdir command as is outside of the cargo-make task? Or did you run several mkdir commands always just creating one subdirectory?

from bevy_game_template.

rgripper avatar rgripper commented on August 17, 2024

Nah, same thing. How would you suggest to debug this 🧐 ? Quite annoying to wait for a whole minute for everything to compile just to get this error.

from bevy_game_template.

NiklasEi avatar NiklasEi commented on August 17, 2024

This seems to be a simple issue, but to be honest I have no idea what mkdir on windows actually does/can do. Seems that there are a lot of possible different setups here (actually "works on my Win10 machine" ^^).
Maybe you could try some small changes like build/web/target -> ./build/web/target? I don't think you need to do a clean download of the template every time. Just make sure to not have the build/web directory, then the situation should be the same as for a fresh download.

from bevy_game_template.

NiklasEi avatar NiklasEi commented on August 17, 2024

This works though

[tasks.create-build-dir]
script_runner = "@duckscript"
script = [
'''
p = canonicalize "build/web/target"
mkdir ${p}
''']

I tested this and for me, it also works. I will push this and maybe @rgripper can verify, that this also solves the issue on his machine?

from bevy_game_template.

sagiegurari avatar sagiegurari commented on August 17, 2024

don't have windows myself, but this is a strange one.
a task with a command + args is basically like running rust std::process::Command which i probably behaves differently than running the command inside a shell.
however, the question is this running inside a linux subsystem?
because i see an example of:

[tasks.create-build-dir]
args = ["-p", "${CARGO_MAKE_WORKING_DIRECTORY}/build/web/target"]
command = "mkdir"
dependencies = ["echo-path"]

and i'm not sure dos knows what -p is (could be wrong).

from bevy_game_template.

MikulasZelinka avatar MikulasZelinka commented on August 17, 2024

I can confirm that the issue appears in all cp, mv and mkdir commands on Windows when run from cargo make serve.

  • However, all of the commands (except for mkdir's -p) work when executed manually outside the make.
  • The workaround #7 (comment) solves the issue.

from bevy_game_template.

NiklasEi avatar NiklasEi commented on August 17, 2024

@MikulasZelinka Thanks for testing and reporting your findings!

@will-hart would you be willing to open a PR to close this issue with your changes above?

from bevy_game_template.

will-hart avatar will-hart commented on August 17, 2024

Hey sorry, been busy with IRL. I can create a PR, although I can't test on MacOS or Linux.

from bevy_game_template.

MikulasZelinka avatar MikulasZelinka commented on August 17, 2024

Link to the relevant PR: #10.

from bevy_game_template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.