User forums > General (but related to Code::Blocks)
Saving a file without an extension
sethjackson:
Recently I saved some files that didn't have an extension on the end (*.cpp, *.txt etc.).
I did File -> New -> Empty file. (added the file to the active project)
I typed in foo as the filename, but C::B saved the file as foo.a.c.
I would expect C::B to tack one extension on the end, but not two (Actually it would be nice if C::B just saved it as foo (no extension), but that is another story).
Is this supposed to happen?
BTW after looking at the code I think the problem (I'm assuming this is a problem) is somewhere in cbEditor::SaveAs(). Maybe with the wxFileDialog.........
MortenMacFly:
Agreed. That's weired. It seems to be related to the number of file extensions (wildcards). If you reduce this, it works properly again. I checked the wildcard string - it get's computed correctly though. So I'd say it's not our fault, but I wouldn't implement a hack around checking to see if the last wildcard (which is always "all files" is selected and then remove the additional file extensions. Let's hope it get's fixed in an upcoming wxWidgets release.
With regards, Morten.
Edit: I just found this piece of code inside wxWidgets:
--- Code: --- wxString::size_type nDot = m_wildCard.find(_T("*."));
if ( nDot != wxString::npos )
nDot++;
else
nDot = 0;
--- End code ---
We *do* have file masks that do not have a dot, e.g. "*Makefile" and "*.py;*SConstruct;*SConscript". MAybe it's our fault...?!
MortenMacFly:
Bingo!!! "Python files|*.py;*SConstruct;*SConscript|" is the culprit. Adding this to any wxFileDialog will result in the strange behaviour for "All files". You can try with using for a wildcard masks:
--- Code: ---Filters = _T("AngelScript files|*.as|Batch files|*.bat;*.cmd;*.nt|Make files|*Makefile;*.mak|Python files|*.py;*SConstruct;*SConscript|All files|*.*");
--- End code ---
This won't work if you select "All files".
So - I'd say we have to fix the file masks (I believe the originate from the lexers)!
With regards, Morten.
MortenMacFly:
now it has begun to become *really* weired: I've removed the extensions accordingly but: no success! Then I tried again my little demo example with the following wildcard:
--- Code: ---Wildcard=AngelScript files|*.as|Batch files|*.bat;*.cmd;*.nt|Make files|*.mak|Python files|*.py|All files|*.*
--- End code ---
Which result's in illegal file extensions! Now where is the issue here? As soon as you remove any of these extensions (e.g. "AngelScript files|*.as" it will work again. But this combination (although it's fully correct) won't work.
Somebody out there who has a glue what's going on here???
With regards, Morten.
Game_Ender:
There is a bug somewhere in the wxWidgets dialog and wildcards parsing. Last time I used it was with wxMac 2.6.3 with STL enabled. Which meant that wxString throws exceptions if you index them wrong, and everything time I tried to use the wildcard features it threw an index out of range exception. I didn't have to make up a patch, so I just worked around it. Debugging into wxWidgets or running it threw valgrind will probably reveal the error. Either that or it is supposed to be used a certain way and we aren't using it that way.
Navigation
[0] Message Index
[#] Next page
Go to full version