particle-dev
particle-dev copied to clipboard
Open/Compiled directory does not change when opening new file
First some facts, you can open a directory without opening a file or you can open a file and the directory that it's in will be displayed; along with all of the files in that directory.
If you open a directory with one file, say ./test1/test1.ino. Go ahead and compile it and all is well.
Now open a file from another directory, say ./test2/test2.ino. Notice that the open directory does not change, it's still showing test1.
With test2.ino active, click the compile button and everything will seem to work fine. You can even flash it to your device... but what do you have? It will be test1.ino's binary, not test2.ino
Does it make sense to change the directory for whichever file is actively selected, and compile based on the open file? Personally I believe it's intuitive that the file I have displaying is the one that will be compiled. With this scheme you could have a bunch of different examples and open them all up, programming whichever one is active... as long as it's in it's own directory ;-)
You can open the ./test2/ directory specifically as stated in the facts, however this is fairly cumbersome to remember to do.
We could add "Compile current file" along side of "Compile project" (which defaults to open directory). This way we would have both behaviours :)

I think just compiling the current file won't do the job though... unless what is implied is that it looks to compile the parent folder that holds the current file? If the visible directory project doesn't change when you select a new file though, I think this will be confusing. It's the behavior I'm seeking, but with no visible feedback that it works that way. Evidence would only be in the Spark Core about which application is running.
Just thinking out loud here: If there were two different compile options, you would have to set it and forget it because you wouldn't want to have 4 different FLASH & VERIFY icons. That would make the UI too busy.
I think if the project (visible directory) just changed with the file that is active, all problems would be solved without needing to add multiple compile options.