include relation problems

include relation problems

Postby fishy » Fri Jun 19, 2009 5:16 am

Hello Steve,

I found a little Problem when using cascaded includes.
( so far I "understood" that the debugger needs the <> signs instead of "" ... is it thought to be fixed or want you to leave this behaviour ? - I have no problem with it, but want to know if you plan to "change" this in future... )

in SciTE and AutoIt it is possible to do something like this:

-----------
main.au3:
-----------
#include<myIncludeFolder/myIncludeFile1.au3>

-----------
myIncludeFolder/myIncludeFile1.au3:
-----------
#include<myGlobals.au3> ; this is not in autoit's include, but on "current script's path"...

-----------
myIncludeFolder/myGlobals.au3:
-----------
; this is just a global file example...
Global $a=10

The debugger tells me not to find "myGlobals"... sure, because the debugger includes myIncludeFolder/myIndludeFile1.au3
- this is correct so far... but now in scite and autoit the current "working" directory also changes while this include is done.
but the debugger keeps it's debugging script path, so sure he will not find myGlobals.au3 "beside" the main.au3

the debugger has to change temporarily into the folder where it includes something (in this case: myIncludeFolder).

can you please fix this behaviour ?
I really need to debug complex structured project files that have to contain relative include paths.
I can not include all files from within one main - because it's a modular project and I do not know what "modules" are
needed in the main. The module itself includes the files it needs.

well the only thing that worked so far, is to "deploy" or copy the include files into the autoit's include folder, e.g.
c:\autoit\include\my\base

then all includes in the modules can be made "absolute" in relation to the autoit include base:
e.g.

myModule1.au3
#include <my/base/doing.au3>
#include <my/base/ding.au3>

myModule2.au3
#include <my/base/dang.au3>

well this is ok so far, but its a bit "tricky" while developing and debugging i need to copy the include files from the deploy folder into the local folder - then debugger will find it. but in scite Alt+i will jump into the autoit directory.
so its dangerous to work on the "wrong" file then.
After debugging i have to deploy the local files back to the autoit include folder so scite shows again the changes files and i get what i really see =)

I think it's not that much effort to support that "relative" including.
I think you just need to change into the directory where the current loaded script is located, and when you recognize an include, you jump into the path relative to the current "loaded"/"active" script path.

ps: please also keep in mind:
you grab all files you find and put them into your debug folder... use unique namings there may be same named include-files:
e.g.:
#include <myBase/lib/modules.au3>
#include <myBase/lib2/modules.au3>


Please tell me when you have done a new version.
Best regards,

Fishy.
fishy
 
Posts: 17
Joined: Tue Jun 02, 2009 7:42 am

Re: include relation problems

Postby fishy » Tue Jul 07, 2009 7:38 am

Hello there,

There is no answer for a long time, up to now.
It's very important to fix this so I can use the debugger properly.

If I have something like:
#include<../myBase.au3>

the debugger does not work - it searches in the debug folder where the debug-script is running.
Also @scriptName is resolved to the debugger script. I have a framework where it's important the
autoit macros work properly.

Greetings,
Fishy.
fishy
 
Posts: 17
Joined: Tue Jun 02, 2009 7:42 am

Re: include relation problems

Postby thefoolonthehill » Tue Jul 07, 2009 7:54 pm

fishy wrote:Hello there,

There is no answer for a long time, up to now.
It's very important to fix this so I can use the debugger properly.

If I have something like:
#include<../myBase.au3>

the debugger does not work - it searches in the debug folder where the debug-script is running.


Sub folders should work in v0.25 now. The format of ../myBase.au3 for a parent folder is not detailed in the AutoIt help. Does this actually work? If so, I can look into it.

fishy wrote:Also @scriptName is resolved to the debugger script. I have a framework where it's important the
autoit macros work properly.

Greetings,
Fishy.


I don't get the same result. If I debug the following code, I get 'ScriptName.au3', not 'ScriptName.Debug Script.au3'.

ScriptName.au3 follows:
Code: Select all
$stemp = @ScriptName

msgbox(0,"",$stemp)
thefoolonthehill
Site Admin
 
Posts: 53
Joined: Thu Dec 18, 2008 3:45 pm

Re: include relation problems

Postby fishy » Thu Jul 09, 2009 12:58 pm

Yes, relation is possible within includes.
It's not that documented there only stands : must be a string - no variable.

in the file folder parent/child/fileA.au3 an include<../fileB.au3> works.
if parent/fileB.au3 does: #include<child/fileC.au3> autoit will do it properly.
if all included files contain #include-once then also this works:
parent/fileB.au3 does: #include<child/fileA.au3>

But i recognized:
$a="myFunctionName" - if you pres Ctrl-J on the myFunctionName it jumps to the function of that name.
if the function is implemented in the same file - OK
if the function is implemented in file that is included in the current script - OK
if the function is implemented in a file that is included over a second include (which is in another folder!), the script runs, but Ctrl-J doesnt work anymore. Maybe I made a mistake but i cant get it working like i wanted =)
It's not debugger "relevant" but only to "show" you that it's possible to relatively include...
e.g:
files.inc.au3 contains:
#include <inc/fileA.au3>
#include <inc/fileB.au3> ; here the myFunctionName function is implemented
#include <inc/fileC.au3>

if you now go to the main-code that may be beside the inc-folder, the script works. It may be Ctrl-J on the string wont find the function, but the autoit interpreter does it without problems...

if you need to call in fileB a function that is in fileA, then you also can think to include ../files.inc.au3 in each of the files in the inc-folder. ( sure you need #include-once in each file ! )

The other thing with the @scriptName...
Hmm. you are right... it seems to work, now - even a MsgBox...

That's a bit strange - I remember having a problem the debugger always crashed - even with files that are ok.
I reinstalled it - now it works.

ok. I will check this again...
if i find time, if the problem still exists, I try to send you a problem-reproducable code.

I checked the "debug" script name by myself and did this:
$script = StringReplace( @scriptname, "Debug Script", "" )
and then used the $script variable in that part i need to "scan" the scripts name.
The part is that i only want to allow to "execute" main.au3 and a file within a "cases" folder.
that #include<frame/mybase/core.au3> fires that code that looks for the executed script name and is located in autoit's include folder.

well then it's ok and my installation may be crashed for any unknown reason =)

Greetings,
Fishy.
fishy
 
Posts: 17
Joined: Tue Jun 02, 2009 7:42 am


Return to AutoIt Debugger

Who is online

Users browsing this forum: No registered users and 1 guest

cron