Non-standart file handling - why and how to beat it?

Hi.
I made a folder with name 'test' and two files: master.ino and lib.ino (to include into master) but the program refuses to open them. What else can I do if I don't want to keep each file in its separate folder?

Put both files in a folder named master then open master.ino and lib.ino will be on a separate tab in the IDE

This not work - only maser.ino is being opened even if I try to open lib.ino

Please explain your folder structure in detail and which files are in which folder

Folder: master
Inside two files: master.ino, lib.ino

As simple as it possible!

Arduino version 1.8 opens only master.ino. When trying to open lib.ino, it opens master.ino instead.

Also, that code in master.ino
#include "lib.ino"
results in fatal error: lib.ino: No such file or directory.

Arduino version 1.8 opens only master.ino.

Please confirm that there is not a second tab in the IDE with lib.ino on it

Yes, lib.ino is in the second tab and it cannot be compiled separately.

It always switches to master.ino, starts compilation from it and CANNOT find lib.ino, despite having it near.

lib.ino is in the second tab and it cannot be compiled separately.

You have just moved the goalposts. You cannot do what you describe. Basically each sketch has to be in a folder with the same name as the sketch in order for it to be compiled by the IDE

Please explain why you want to do it

Thanks for your answer. Now i know I can't do it.

I just wanted to have all project files in the same place so I and my co-workers could test them separately, yet having no additional instructions about project structure.

You can create a folder for the project then have a folder for each separate sketch in that folder if that helps

I moved lib.ino to lib folder inside master, and there's still compilation error "not found" either for #include "lib.ino" or "lib/lib.ino"

I see there's something wrong with file handling in Arduino, but what's exactly wrong?

The sketch is copied to a temporary build folder before being compiled. .ino files in subfolders are not copied, thus the error. You can find the location of that temporary folder by enabling File > Preferences > Show verbose output during: compilation, compiling, then checking the contents of the black console window at the bottom of the Arduino IDE window.

You can put files in subfolders, but these must be normal source files (.h, .cpp, .c, .S). Just as you (hopefully) wouldn't #include a .cpp file, you also shouldn't #include .ino files. If you want source files not in the root sketch folder to be compiled, you must put them under the src subfolder. The Arduino IDE recursively compiles the contents of that folder.

But I cannot compile and run .h files.
Things getting too complex.

father_gorry:
But I cannot compile and run .h files.

Please provide a detailed explanation of what you mean by that.

father_gorry:
Things getting too complex.

If you want it simple, just put all the files in one folder. But we can definitely help you use a different folder structure.