The same problem is for webkit working as a Win32 process. It does not reaload after changed scripts. :(
I got fed up with that too and hacked up this little program to monitor a set of directories and restart webkit when necessary. Not as good as the real thing, but better than nothing...
#################################################################### ######################### FileMonitor.py ###########################
# Instructions # - Adjust liDirectoriesToWatch and sRestartCommand # - Start > Run > cmd # - c:\Program Files\FileMonitor>FileMonitor
import time import os import os.path import sys
class FileMonitor:
def liDirectoriesToWatch(self):
return ['c:\\path\\to\\context\\Context',
'c:\\path\\to\\context\\lib'] def liFileExtensionsToWatch(self):
return ['py'] def iPollInterval(self):
return 10 def sRestartCommand(self):
return 'c:\\path\\to\\context\\NTService restart' def __init__(self):
self.__bNeedRestart = 0
self.__diMTimes = {} def bNeedRestart(self):
return self.__bNeedRestart def getMTime(self, sPath):
return os.path.getmtime(sPath) def restartServer(self):
print 'The server is restarting now.'
print self.sRestartCommand()
try:
oOutput = os.system(self.sRestartCommand())
print 'Output is %s' % (repr(oOutput))
except:
print 'Exception occurred'
self.__bNeedRestart = 0 def updateFiles(self):
for sDirectory in self.liDirectoriesToWatch():
if os.path.isdir(sDirectory):
self.updateDirectory(sDirectory)
else:
print '%s is not a directory.' % (sDirectory) def updateDirectory(self, sDirectory):
for sFile in os.listdir(sDirectory):
sPath = os.path.normpath(sDirectory + os.sep + sFile)
try:
sExtension = sPath[sPath.rindex('.') + 1:]
except ValueError:
sExtension = '' if os.path.isdir(sPath):
self.updateDirectory(sPath)
elif os.path.isfile(sPath) and sExtension in \
self.liFileExtensionsToWatch():
self.updateFile(sPath) def updateFile(self, sPath):
iNewMTime = self.getMTime(sPath)
if sPath in self.__diMTimes:
iMTime = self.__diMTimes[sPath]
if iMTime < iNewMTime:
print '%s has been modified.' % (sPath)
self.__bNeedRestart = 1
else:
print '%s is being monitored.' % (sPath)
self.__diMTimes[sPath] = iNewMTime def run(self):
print 'FileMonitor Starting.'
try:
while 1:
self.updateFiles()
if self.bNeedRestart():
self.restartServer()
time.sleep(self.iPollInterval())
except KeyboardInterrupt:
print 'FileMonitor Exiting.'
f = FileMonitor() f.run()
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
