Go Down

Topic: 3rd-party Variable (Read 341 times) previous topic - next topic

WizIO

Is there a variable {CURRENT_PROJECT_PATH} ?

from C:\work\Arduino\HelloWorld\HelloWorld.ino

I need this: C:\work\Arduino\HelloWorld\

pert

The __FILE__ macro will contain the string C:\work\Arduino\HelloWorld\HelloWorld.ino. You can then use string utility functions to extract the sketch folder path from that string.

Note that this won't work as you are expecting if the sketch was modified and not saved because in that case the actual file is stored in a temporary folder.

WizIO

I don't ask about source code .... about platform.txt

I need to copy a file from project folder to build folder....


pert

OK, then you are looking for {sketch_path}.

WizIO

YES :) but {sketch_path} not exist as variable...

pert

It certainly does. For example, here you can see it's used in ATTinyCore:
https://github.com/SpenceKonde/ATTinyCore/blob/master/avr/platform.txt#L89-L97

The tricky thing is that not all properties are defined for all recipes/patterns in platform.txt. To investigate this, I created a dummy hardware package which attempts to use all known properties in every recipe/pattern. You can determine where each property is and is not defined as well as how the property override system works by examining the verbose compilation output after compiling for the dummy board provided by that package:
https://github.com/per1234/InoPlatformPropertiesTest

WizIO

I don`t know why {sketch_path} not work for me :(

I get other solution
{build.path}/build.options.json <<<< there is variable 'sketchLocation'

Go Up