Author Topic: Files modified externally not refreshed  (Read 5832 times)

Offline jumafra

  • Single posting newcomer
  • *
  • Posts: 9
Files modified externally not refreshed
« on: January 16, 2008, 11:33:50 pm »
Hello,

I have some post-build commands that create/replace a log file which I have open on C::B editor.
After build process ends, the file isn't refreshed/reloaded, unless C::B looses and regains focus.
Would it be possible to have it reload files which are modified externally immediatly?
Regards,
Juan.

edit:
Using Rev 4820 on WinXP SP2
« Last Edit: January 16, 2008, 11:49:05 pm by jumafra »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Files modified externally not refreshed
« Reply #1 on: January 17, 2008, 01:19:25 pm »
Would it be possible to have it reload files which are modified externally immediatly?
This is rather unlikely.
Becasue that would require polling all files "permanently" for modification. I guess that's not desired. Currently the modification check is bound to when the editor gets activated again. At that time it's most likely the user wold like to really modify the file. So to avoid conflicts the question is raised there at minimal (computing) cost.
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: Files modified externally not refreshed
« Reply #2 on: January 17, 2008, 01:20:32 pm »
Anyways: I guess it could be easy to implement as a plugin - something like a menu entry "refresh all open editors". A very simple (5-liner or so ;-)) C::B plugin.
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 jumafra

  • Single posting newcomer
  • *
  • Posts: 9
Re: Files modified externally not refreshed
« Reply #3 on: January 18, 2008, 03:12:47 am »
Currently the modification check is bound to when the editor gets activated again.
Right now C::B itself has to loose focus for the file(s) to be refreshed. Wouldn't it be better to poll open files when switching editor tabs?.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Files modified externally not refreshed
« Reply #4 on: January 18, 2008, 09:29:36 am »
That might work, but then we'd probably have people working on notebooks complain that the CPU fan spins up every time. Not sure.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline jumafra

  • Single posting newcomer
  • *
  • Posts: 9
Re: Files modified externally not refreshed
« Reply #5 on: January 19, 2008, 07:13:46 am »
Yeah, that might increase resources usage unnecessarily for most C::B users.
I guess I'll have to bear with it, and remember to force refresh. Or maybe, as Morten suggests, to implement that as a plugin... If only I knew how.
Regards
Juan

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Files modified externally not refreshed
« Reply #6 on: January 19, 2008, 01:10:33 pm »
Like this:

[attachment deleted by admin]
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline jumafra

  • Single posting newcomer
  • *
  • Posts: 9
Re: Files modified externally not refreshed
« Reply #7 on: January 22, 2008, 06:28:35 am »
Thanks Thomas. I'll give it a try when I have a proper wx building environment set.
Regards
Juan

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Files modified externally not refreshed
« Reply #8 on: January 22, 2008, 08:17:38 am »
Like this:
Did I say 5-liner? Thomas did it in a two-liner... cool stuff! ;-)
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 thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Files modified externally not refreshed
« Reply #9 on: January 22, 2008, 01:21:22 pm »
Actually that plugin is harmless enough to be in the source tree and nightly builds.

There's nothing in it that could possibly break something. The worst thing to happen would be some CPU cycles burnt, and if someone doesn't like it, he doesn't need to load the plugin...
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Files modified externally not refreshed
« Reply #10 on: January 22, 2008, 04:00:06 pm »
IMO those two lines are harmless+useful enough that they shouldn't be a plugin at all and part of the core (make it possible to disable in environment/editor settings)