User forums > Using Code::Blocks

Opening project with undefined global variables

<< < (3/3)

MortenMacFly:

--- Quote from: jens on February 10, 2010, 12:34:54 pm ---I don't know, whether it makes sense or can be done easily.

--- End quote ---
The problem here is: You mostly don't know that a project you want to open to inspect will contain user vars. So you wouldn't use the "read-only" option in the first place. The annoyance remains...

Edit:
What I don't get:
look at this code from UserVarManager:

--- Code: ---        if (Manager::Get()->GetProjectManager()->IsLoading())
        {
            // a project/workspace is being loaded.
            // no need to bug the user now about global vars.
            // just preempt it; ProjectManager will call Arrogate() when it's done.
            Preempt(variable);
            return variable;
        }
        else
        {
            wxString msg;
            msg.Printf(_("In the currently active Set, Code::Blocks does not know\nthe global compiler variable \"%s\".\n\nPlease define it."), package.c_str());
            InfoWindow::Display(_("Global Compiler Variables"), msg , 8000, 1000);
            UsrGlblMgrEditDialog d;
            d.AddVar(package);
            PlaceWindow(&d);
            d.ShowModal();
        }

--- End code ---
...so glorious Thomas thought about that issue, but it seems not to work (anymore?!).

thomas:

--- Quote from: MortenMacFly on February 10, 2010, 12:48:32 pm ---...so glorious Thomas thought about that issue, but it seems not to work (anymore?!).
--- End quote ---
Hmmm actually I had forgotten about having implemented that already  :) Yes, this was indeed supposed to work that way, no idea why it does not now.


--- Quote from: jens on February 10, 2010, 12:34:54 pm ---What about doing some kind of open "readonly"
--- End quote ---
That's actually a good idea too. One could add a readonly flag which in this context means "return the value if it's there, and return an empty string if it's not there, but don't do anything else".
One would have to make sure that getting an empty string is handled gracefully, though. Project loading shouldn't throw up 20 "path not found" errors as a consequence (and shouldn't crash!), but the user should still know that something isn't quite right.

Navigation

[0] Message Index

[*] Previous page

Go to full version