ChrisS85 / CGUI

An object-oriented GUI library for AutoHotkey
22 stars 19 forks source link

#Include dir changed #49

Closed rshipp closed 12 years ago

rshipp commented 12 years ago

When I #include CGUI, it somehow changes the include dir, so that future includes have to be specified with an absolute path. For example, this is my setup:

main ahk script:

#include src\somefile.ahk
#include src\ui.ahk
#include src\someotherfile.ahk

ui.ahk:

#include <CGUI>

Now, when I run the main script, I get an error:

#Include file "src\someotherfile.ahk" cannot be opened.

If I change the main script to

#include src\somefile.ahk
#include src\ui.ahk
#include %A_ScriptDir%\src\someotherfile.ahk

or

#include %A_ScriptDir%\src\somefile.ahk
#include %A_ScriptDir%\src\ui.ahk
#include %A_ScriptDir%\src\someotherfile.ahk

then everything works as expected. I'm not sure what's causing this, but is there any way to stop this behavior?

Thanks

Edit: Adding #include %A_ScriptDir% after the CGUI include also works to reset my include dir to its original value.

rshipp commented 12 years ago

Oops, nevermind. I just realized that CGUI must be included at the end of the script (or at least the auto-execute section) in order to function properly anyway.

ChrisS85 commented 12 years ago

This is because #include changes the current working directory. If you use #include Lib\File.ahk it won't do this AFAIK.

On Sat, Jun 30, 2012 at 2:15 AM, george2 < reply@reply.github.com

wrote:

When I #include CGUI, it somehow changes the include dir, so that future includes have to be specified with an absolute path. For example, this is my setup:

main ahk script:

#include src\somefile.ahk
#include src\ui.ahk
#include src\someotherfile.ahk

ui.ahk:

#include <CGUI>

Now, when I run the main script, I get an error:

#Include file "src\someotherfile.ahk" cannot be opened.

If I change the main script to

#include src\somefile.ahk
#include src\ui.ahk
#include %A_ScriptDir%\src\someotherfile.ahk

or

#include %A_ScriptDir%\src\somefile.ahk
#include %A_ScriptDir%\src\ui.ahk
#include %A_ScriptDir%\src\someotherfile.ahk

then everything works as expected. I'm not sure what's causing this, but is there any way to stop this behavior?

Thanks

Edit: Adding #include %A_ScriptDir% after the CGUI include also works to reset my include dir to its original value.


Reply to this email directly or view it on GitHub: https://github.com/ChrisS85/CGUI/issues/49

Uberi commented 12 years ago

This will be fixed in AHK_L v1.1.08.00.