News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Changing read-only for open file

Started by daniloz, March 24, 2010, 10:18:09 AM

Previous topic - Next topic

daniloz

Hi All,

I'm using the svn R6196 (truck) version of C::B and I'm very glad with the new button "File is read-only" in file properties. I'm even more happy with the fact that I can now untick it and modify the file, without having to go somewhere else to remove the read-only attribute.

Everything works fine if I do so with a file which is not open in the editor and then open it, i.e. I can modify the file.

HOWEVER, I've notice that if the file is already open in the editor and then I remove the read-only attribute, I *cannot* modify the file. Then, I have to close and open the file again in order to be able to modify it.

- Is it possible to refresh the file in the editor so that the editor realizes that the file is not read-only anymore?

- Can it be done automatically whenever one changes the read-only attribute?

Btw, I've notice that the inverse is also true, i.e. if the file is open and I *tick* the read-only, the editor still allows me to change the file until I close and open it again.

Thx,
daniloz

MortenMacFly

Quote from: daniloz on March 24, 2010, 10:18:09 AM
HOWEVER, I've notice that if the file is already open in the editor and then I remove the read-only attribute, I *cannot* modify the file. Then, I have to close and open the file again in order to be able to modify it.
This is not as easy as you might think. Keep in mind that an editor is a volatile "copy" of your file. But it might be possible... I'll have a look into it...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

MortenMacFly

BTW: I just realised a few race conditions in the current implementation:
1.) If the file is not read-only and opened in and editor and the editor is modified, setting the file to read-only should not be allowed. For now, the editor remains editable but cannot be saved under the same name (bad!!!).
2.) The opposite: If the file is read-only and opened as a read-only editor and then toggled the editor should become editable (that's what you meant I suppose).
3.) Icon handling in the project tree does simply not work properly.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

daniloz

Thanks for your reply...

Quote from: MortenMacFly on March 24, 2010, 04:39:55 PM
2.) The opposite: If the file is read-only and opened as a read-only editor and then toggled the editor should become editable (that's what you meant I suppose).

That's exactly what I meant...

Quote from: MortenMacFly on March 24, 2010, 04:39:55 PM
3.) Icon handling in the project tree does simply not work properly.

That would be also a neat feature to have... :-)

fubo

Hi,

what is the status of this issue? 10.05 and latest SVN 6688 still has same behaviour.

MortenMacFly

Quote from: fubo on October 22, 2010, 05:23:06 PM
what is the status of this issue? 10.05 and latest SVN 6688 still has same behaviour.
I've some adjustments in my local copy concerning this but they are not yet ready for a release...
Meanwhile I realised that there are even more conditions to handle.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

ankurnigam18

Hi everyone,
I am a new member and I like Code::Blocks.
I usually use it on Win XP SP3.
Now I opened my project on Windows Vista, with the same 10.05 version.
I am unable to save my "main.cpp" file.
I check it's properties in CB, it shows "File is read-only" enabled.
I check it's properties in Windows, it shows "Read-only" disabled.
I try to disable "File is read-only" in CB, but not able to.
That is the trouble.

Thanks,
Ankur