Author Topic: Changing read-only for open file  (Read 6056 times)

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Changing read-only for open file
« on: March 24, 2010, 10:18:09 am »
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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Changing read-only for open file
« Reply #1 on: March 24, 2010, 04:16:23 pm »
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Changing read-only for open file
« Reply #2 on: March 24, 2010, 04:39:55 pm »
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: Changing read-only for open file
« Reply #3 on: March 24, 2010, 05:49:55 pm »
Thanks for your reply...

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...

3.) Icon handling in the project tree does simply not work properly.

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

Offline fubo

  • Multiple posting newcomer
  • *
  • Posts: 38
Re: Changing read-only for open file
« Reply #4 on: October 22, 2010, 05:23:06 pm »
Hi,

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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Changing read-only for open file
« Reply #5 on: October 22, 2010, 08:13:34 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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ankurnigam18

  • Single posting newcomer
  • *
  • Posts: 4
Re: Changing read-only for open file
« Reply #6 on: May 13, 2011, 01:50:04 pm »
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