User forums > Help

problem with "File/New/File..."

<< < (5/6) > >>

nenin:

--- Quote ---Does this only happen if you use the new file wizard,
--- End quote ---
Yes. I dont use "empty file" option, and I dont remember problems with adding already existed files. 

--- Quote ---Can you confirm, that all files are children of the project folder?
--- End quote ---
Yes. But looks like that issue appeared after I added already existed files from child folder to project. I added 2 files from sub-folder, then I opened wizard, it proposed to create new file inside this sub-folder (it is actually "rtb" folder in project tree), not in the project root. And then it started...


--- Quote --- Do the failing files have absolute paths with upper or lower case drive letters?
--- End quote ---
It is it:
--- Code: ---<Unit filename="C:/mingw/projects/fltk_kikus_v0/dddd.cpp" />
--- End code ---
In fresh new project, which is OK, "C"  is big (see attach). 

--- Quote ---Make a copy of the project file and replace the drive letter with the other case. Does the problem goes away?
--- End quote ---
Strange, but Yes! I did it, opened it in C::B.  If I open and then  "Save"  project with corrected "c", I got normal record
--- Code: ---<Unit filename="dddd.cpp" />
--- End code ---
.
However, when I made "Save As" for this corrected project, all file records in cbp became absolute:

--- Code: --- <Unit filename="c:/mingw/projects/fltk_kikus_v0/main.cpp">
<Option virtualFolder="main/" />
--- End code ---


--- Quote ---Have you added the path by copy and paste?
--- End quote ---
No. I have no idea why it appeared.
Just in case: I`m using Polish Win10. But for sure there are no non-ascii letters in path, etc.

BlueHazzard:

--- Quote ---However, when I made "Save As" for this corrected project, all file records in cbp became absolute:
--- End quote ---
I can not reproduce this. Steps i do:
1) Cerate a project and add a file
2) Close codeblocks
3) Open the project file in Editor, Modify the path to a source file to absolute and use lower case drive letter
4) Open in codeblocks -> path is absolute
5) Close codeblocks
6) Open the project file in text editor, modify the drive letter to upper case, save
7) Open project in codeblocks -> Project tree is working as expected
8) Save project as -> Paths are all relative

BlueHazzard:
I think i have found the problem on the loading side:
in sdk\cbproject.cpp:870

--- Code: ---#ifdef __WXMSW__
    // for Windows, make sure the filename is not on another drive...
    if (   (local_filename.Length() > 1)
        && (local_filename.GetChar(1) == _T(':'))
        && (fname.GetVolume() != wxFileName(m_Filename).GetVolume()) )
        // (this is a quick test to avoid the costly wxFileName ctor below)
    {
        fname.Assign(filename);
    }

--- End code ---
we check if the drive letters are different. As far as i can find drive letters are case insensitive on windows. So we should use a case insensitive comparison here...

--- Code: ---#ifdef __WXMSW__
    // for Windows, make sure the filename is not on another drive...
    if (   (local_filename.Length() > 1)
        && (local_filename.GetChar(1) == _T(':'))
        && !(fname.GetVolume().IsSameAs(wxFileName(m_Filename).GetVolume(), false)) )
        // (this is a quick test to avoid the costly wxFileName ctor below)
    {
        fname.Assign(filename);
    }
    else if (fname.GetFullPath().StartsWith(_T("\\\\"))) // UNC path
    {
        fname.Assign(filename);
    }
    else
#endif

--- End code ---

I have not searched on the file creation site, because i can not reproduce it...

nenin:
Looks like I made  fresh invalid project.
See attachment.
1.  "tst_cbp_00.cbp"  - aready corrupted, but nothing is visible
2.  "tst_cbp_01.cbp" - cloned and saved after creation of test.cpp by wizard.
3.  "tst_cbp_02.cbp" - tst_cbp_00.cbp  just as it was "Save As"
It started after I just tried do add files from "mingw_thrd\" but canceled operation.

BlueHazzard:
A fix is in trunk. and you can try it in the next nightly...
In the worst case you have to remove and add the problematic files again, but it should fix all during opening the project...

 [r12046]

If you still have the problem, please report back..

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version