Understanding View Open Include

Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
Post Reply
jussij
Site Admin
Posts: 2445
Joined: Fri Aug 13, 2004 5:10 pm

Understanding View Open Include

Post by jussij » Fri Sep 23, 2005 11:39 pm

This is an explanation on the View, Open Include File menu which is mapped to the FileOpenInLine keyboard function. This menu attempts to a load the file listed on the current line of any document or tool window.

Consider the following set of files arranged in the indicated directory structure:

Code: Select all

C:\example\file1.txt
C:\example\others\file2.txt
C:\example\others\file3.txt
Assume this is the contents of file1.txt and it is loaded into Zeus as the active document:

Code: Select all

file1.txt
file2.txt
file3.txt
others\file2.txt
others\file3.txt
Note that since c:\exmaple\file1.txt is the active file, this means the current active directory is c:\exmaple\.

If the open include menu is then used on each of these lines in turn these would be the results
  1. file1.txt - works fine (happy to open ourselves)
  2. file2.txt - fails (can't find this file c:\exmaple\ + \file2.txt)
  3. file3.txt - fails (can't find this file c:\exmaple\ + \file3.txt)
  4. others\file2.txt - works (finds c:\exmaple\ + others\file2.txt)
  5. others\file3.txt - works (finds c:\exmaple\ + others\file3.txt)
Now use the Options Properties menu and in the Search Path entry add the following text:c:\example\others; and repeat the test. Now all the files are open correctly :)

So why has change made it work :?:

Now when Zeus tries to load the files, it also uses the search path in the search, meaning you get these results:
  1. file1.txt - works fine (happy to to open ourselves)
  2. file2.txt - fails (can't find this file c:\exmaple\ + \file2.txt)
  3. file2.txt - works (finds c:\exmaple\others + \file2.txt)
  4. file3.txt - fails (can't find this file c:\exmaple\ + \file3.txt)
  5. file3.txt - works (finds c:\exmaple\others + \file3.txt)
  6. others\file2.txt - works (finds c:\exmaple\ + others\file2.txt)
  7. others\file3.txt - works (finds c:\exmaple\ + others\file3.txt)
Now consider adding another file more\file4.txt as shown below:

Code: Select all

file1.txt
file2.txt
file3.txt
others\file2.txt
others\file3.txt
file4.txt
more\file4.txt
This gives this extra two extra results:
  1. file4.txt - fails (can't find c:\exmaple + \file4.txt)
  2. more\file4.txt - works (finds c:\exmaple\ + more\file4.txt)
By using the Options Properties menu and changing the search path to be c:\example\others;c:\example\more; and once again all the files load correctly :)

One other thing worth mentioning is the following case. Consider this text as being the contents of the file2.txt file:

Code: Select all

file3
file3.txt
This gives this extra results:
  1. file3 - works (loads if cursor is on the word file3)
  2. file3.bad - works (loads file3.txt if file3 is the selected text)
  3. file3.txt - works (file4.txt)
How did Zeus load the first case :?:

In this special case Zeus used the current word or selected text as the base of the file name and then appended the extension of the current file to create the full file name.

This is feature is particularly useful for languages like Java where the name of the class matches the name of the file in which it is defined.

Things to remember:
  • The search path above is defined in the document type. This means it is only used when the active document is of the same document type.
  • The exception to this rules is when the search path is added to the default document type. In this case it will be used by all documents.
  • The search path can also be defined in the General section of the workspace settings.
  • The file open include works for all windows.
  • If this menus fails it can mean one of two things. Zeus could it could not find a file name in the current line or the file name that was found could not be located on the disk.
  • If you highlight some text you can force Zeus to use the highlighted text as the file name.
Cheers Jussi

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 2 guests