News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
Function to return the current directory
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
RE: Function to return the current directory

The dirname function is not as reliable as I had hoped. It worked fine with my preliminary test, but when testing a few possible variations (such as running the script in the current directory) it failed quickly. I want to make it work dependably for my own uses as well, so it'll be something I'll look into further sometime in the next few days. Might just need a little tweaking, or might need to be rewitten.

Dynamic submenus look terribly complicated. I was looking at the menu stuff in Erco's FLTK cheat page last night, and nothing was making much sense to me =op
http://seriss.com/people/erco/fltk/

EDIT: it seems that the function was doing what it should; my problems were coming from trying to use the result in a way it's not intended...namely, trying to dofile() with a filename path other than ./
I assume there's a way to modify the dofile/require search path, but i haven't looked into it yet.

EDIT2: Of course I assumed incorrectly again. The error was caused by the script that was being loaded with dofile(). Since it required files found in a subdirectory, I needed to pass the base directory on to it. Seems to work again.

On the subject of dynamic menus, it seems to be a little bit easier than I thought, assuming you keep track of the number which represents each menu item. I'm thinking there must be a way to utilize the item's label, but haven't experimented with that yet (maybe the menu is a table?).
The Fl_Menu_Item documentation contains a list of constants that apply to various flags, which can be modified with Fl_Menu:mode(item_number,flag). Zero is not listed, but it refers to the active state of an item. It seems you can use other Fl_Menu methods to remove, rename, and replace items, but that's something else I haven't looked into yet.

This post was last modified: 07-19-2007 03:50 PM by mikshaw.

07-18-2007 03:22 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
RE: Function to return the current directory - mikshaw - 07-18-2007 03:22 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: