Include file path [SOLVED]

Blitz3D Forums/Blitz3D Beginners Area/Include file path [SOLVED]

Mikorians(Posted 2016) [#1]
Am I STUCK with:

Include "D:\Program Files\Blitz3D\Include\FastExt.bb"

Because

Include (GetEnv$("BlitzPath")+...)

Doesn't work of course...
Anything in the parser for replacing text?
I have a lot of includes and dll's

I'm not forgetting something fundamental am I?


RustyKristi(Posted 2016) [#2]
Consider the FastExt.bb file relative to your main file or the source file that calls it. No need to use GetEnv for that.


Mikorians(Posted 2016) [#3]
"..\..\folder" ?
My program's on another 3 machines on different drives...
Sigh. Not in the Blitz folder on any.


RustyKristi(Posted 2016) [#4]
yes, just copy it beside it. What's the problem??? I was using FastExt.bb or any other lib with include.

I'm not forgetting something fundamental am I?


The fundamental thing to do is make your setup easy, cause you're the one who is using it. :-)

My program's on another 3 machines on different drives...


This is not a fundamental thing to do. Are you kidding me? You are giving yourself a hard time.


Mikorians(Posted 2016) [#5]
Some have C: as the install drive, some are D:
Some are XP, some are W10.
The folders and HDD's are just arranged differently.
So... You'd have me reorder the whole systems?

I know, I know. It all sounds dumb.
I guess I'll just put the includes with my program and bag it.

But what I'm ASKING is- Relative path. Ok.
No OTHER command options, directives, #Defines or
Anything else I should know/remember that I forgot
with regards to the Blitz Parser?


RustyKristi(Posted 2016) [#6]
Yes, if you're into programming, it is unusual to use absolute paths. It should be all relative paths.

But if you're persistent with the GETENV question, Blitz does not allow to use arbitrary or variable string in Include command, that is why it is either you hard code the full absolute path or use relative path which is the commonly used method.

See online manual, under splinux comment, that will answer your question. :-)

http://www.blitzbasic.com/b3ddocs/command.php?name=include&ref=goto


Anything else I should know/remember that I forgot
with regards to the Blitz Parser?


No clue what you still missed regarding blitz3d parser, but you can always ask and post your question here.


RustyKristi(Posted 2016) [#7]
As a follow up note, since Blitz3D is now open source, there's no one stopping you at what you're trying to do with getenv and include.

If you're familiar with C++ then perhaps just modify the commands at your own disposal and make it your own version.


Bobysait(Posted 2016) [#8]
Include are preprocessor stuff, you can't use "runtime" expression with "compiled" expression (in other words, a Constant can't be modified ... which makes sense), so GetEnv won't work, and there is probably no real way to do it even by modifying the blitz3d sources unless you hard code the system environment variables to your code ... and whatever, "Include" command won't let you "add" an expression to another with or without constant expressions because strings are computed at "runtime", not at "compile" time.

Then, you're running a blitz source from your local network ?

Well, I did it all the time without further problem, all you need is to set the static pathes to the computer that holds the include file. (but remember decls need to be in the running blitz3d userlibs folder, eventually, the dll (if any) can be in the folder of your application)
-> So, if you have a shared source folder in your local network, go at its location with your browser and copy the adress, then paste it in your blitz code
For example, in my network, I've got a PC called "MOON" which contains a source folder "SOURCES" in the "SharedFolder" path and a blitz file in it "temp.bb"
(for the purpose, let's keep its content very simple)
Function Do()
 Print "Booh !"
End Function


Now the "local" file you run (the main source -> this one can be anywhere on the network, blitz will compile it in the same folder, but you need to take care about rights of writing and execution to this folder, especially on local network)
Include "\\MOON\SharedFolders\SOURCES\Temp.bb"

Do()
WaitKey()
End





@RustyKristi : Maybe you only consider blitz for standalone stuff, but it can be usefull for tools and many other things, like remote stuff (I remember a program I did to list and update video and musique on all my network, each machines could update the list and run the server if required, all made in blitz3d).
And by the way, as it's compile time stuff, once a file is included into the executable, it is useless to the execution, so there is in the end no static path to file, it's only required for compilation.


_PJ_(Posted 2016) [#9]
there is probably no real way to do it even by modifying the blitz3d sources unless you hard code the system environment variables to your code ...


A ridiculously kludged together switch/case of nested if within the blitzcc.exe source code that checks the location of what's being compiled against the path provided in the "include" directive and intercepts and modifies it at compilation time for the compilation procedure.

Really, I agree that Mikorians is making it hard for himself.
_____________________________________________
I suggest the following:

In EACH of the computers' hard drives at a suitably relative location to the source of EACH program, create a sample "FastLib Include.bb" wrapper

this code will then contain the FULL path to the relative FastLib.bb file for that machine, whilst Include "Fast Lib Include.bb" is all that's required for the program itself regardless of where it is.


Bobysait(Posted 2016) [#10]

A ridiculously kludged together switch/case of nested if within the blitzcc.exe source code that checks the location of what's being compiled against the path provided in the "include" directive and intercepts and modifies it at compilation time for the compilation procedure.



Recompile blitz sources is not that easy, but if you want to give it a try, it's probably here (/compiler/parser.cpp at line 93 -> https://github.com/blitz-research/blitz3d/blob/master/compiler/parser.cpp)
I suppose that we can unlink all the projects and only compile blitzcc, so it should be easier than recompile the whole package with its dependancies.




RustyKristi(Posted 2016) [#11]
@Bobysait

I'm not saying that. Well it depends on your knowledge which is out of the scope of a normal blitz installation. If you're willing to elaborate on those then please do.

I'm stating that it's not normal to use absolute path in includes let alone variable paths on the vanilla version, it's not allowed (variable) and bad practice (absolute) but as I have said he's welcome to modify the source.

For other compilers/ide it's not a problem, I'm sure you already know what <> in

#include <window.h>

means. Not gonna happen in blitz unless you make it to be via source.

PJ suggestion is also good, no hassle and if you don't want to have any more trouble or stick with the license free vanilla version.


RustyKristi(Posted 2016) [#12]
So you already provided the solution, problem solved I guess.

The next step is get Visual C++ 6.0 (which is outdated) or use Ploppy's VS2010/VS2013 version.


Mikorians(Posted 2016) [#13]
Thanks to all!

In short-
So I could include in an 'local system' include as a hoaky solution?
That might work. Bad practices are unavoidable right now.

I won't explain why my systems are a mess. Ugh.

Now... Undocumented features/commands/expressions are what I am curious about.
Relevant to 1.106.
Link?