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

Set working directory for fips run #297

Open
kathrindc opened this issue Oct 8, 2024 · 1 comment
Open

Set working directory for fips run #297

kathrindc opened this issue Oct 8, 2024 · 1 comment

Comments

@kathrindc
Copy link

kathrindc commented Oct 8, 2024

Hi there!
I might just be overlooking something, but is there a way to set the working directory for ./fips run to the project folder?
I have some assets that need to be loaded in during runtime, which would end up in the same folder as the executable in the finished deployment. As of now, I am calling ./fips build and then manually invoking the produced binary in the correct path.

edit: grammar

@floooh
Copy link
Owner

floooh commented Oct 8, 2024

It's an obscure feature and I don't think it's documented anywhere, but you can add a run: section to the fips.yml file in the root directory where you can provide a cwd for specific run targets, for instance like this:

https://github.com/fips-libs/fips-bgfx/blob/master/fips.yml

...where cwd: . is the project directory.

For more advanced things you're probably better off writing a 'generator script' (misleading name, since originally those were meant as code generator scripts, but they can also be used to build a simple 'asset pipeline', for instance this project contains two common utility scripts, one for copying asset files, and one for generating a header with embedded binary data:

https://github.com/fips-libs/fips-utils

...e.g. the file copy script looks like this:

https://github.com/fips-libs/fips-utils/blob/master/fips-files/generators/copy.py

...since you have full access to the (internal) fips API, you could also use that to run executables by doing the same thing that fips run does:

fips/verbs/run.py

Lines 27 to 28 in 3d05e74

target_cwd = util.lookup_target_cwd(proj_dir, target_name)
retcode = project.run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd)

...but if the executable is 'bootstrapped' in the same build process setting up the right dependencies could be tricky... I don't think I have an example around for that situation.

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

No branches or pull requests

2 participants