- Sometimes when I am running an app in the IDE and it crashes - the app.debug file is left in the folder preventing me from running the app again. I have to go to the folder and manually delete the file.
Is there a way to use scripts to check for the debug file name and delete it, prior to running the debugger?
- My app has problems properly displaying its windows in the debugger. This happens on the first run of the app (after loading into Xojo) and immediately after the app terminates abnormally (e.g. by pressing the Stop button). I have to run the app, Quit it, and then run it again for the windows to display properly.
This has been reported in Feedback. Clearly there is some kind of buffer or cache which is not clearing properly - and only gets cleared on a Quit. Is there a script I can use to flush out this problem prior to running?
Jim
Only saw the topic today.
- Yes there is
Need to look this up at home.
- Which OS are you on? Have never seen this on Mac OS. Get a search tool like Find Any File, which can show you files that have been created in the last minutes or so. Then delete the files as needed.
Beatrix
- Thanks - if you have a script for this it would help.
- This is MacOS.
Re your second comment on 2, I think you intended that for item 1. What I’m looking for is a way to automate this in a script at debug time.
Hi James,
- here is the script:
[code] dim dbg as String
if debugBuild then dbg = “.debug”
dim appNameForShell as string
appNameForShell = PropertyValue(“App.MacOSXAppName”) + dbg +".app"
appNameForShell = replaceall(appNameForShell, " ", "\ ")
dim CountSlashes as Integer = CountFields(ProjectShellPath, "/")
dim ProjectName as string = NthField(ProjectShellPath, "/", CountSlashes)
dim ProjectPath as String = Left(ProjectShellPath, Len(ProjectShellPath) - Len(ProjectName))
dim theCommand as String
theCommand = "rm -rf " + ProjectPath + appNameForShell
dim theResult as String
theResult = DoShellCommand(theCommand)
if theResult <> "" then print theResult
function getShellString(theString as String) as string
Return ReplaceAll(theString, " ", "\\ ")
end Function[/code]
- If you have located the files with Find any Files then you can use something similar to the script above to delete the files. Check Application Support and Cache files in the user library.
However, I’m also on the Mac and have NEVER seen something like you describe. Have you tried the usual suspects of creating another user or testing at another computer?
Beatrix
I finally got around to using your script. Works well thanks - I made a few mods per attached to use the function call and extend it to include a few more escape characters. There is probably a more comprehensive version of this using Regex or something - but this works for the moment.
The revised code looks like this:
[code] dim dbg as String
if debugBuild then dbg = “.debug”
dim appNameForShell as string
appNameForShell = PropertyValue(“App.MacOSXAppName”) + dbg +".app"
appNameForShell = getShellString(appNameForShell)
dim CountSlashes as Integer = CountFields(ProjectShellPath, “/”)
dim ProjectName as string = NthField(ProjectShellPath, “/”, CountSlashes)
dim ProjectPath as String = Left(ProjectShellPath, Len(ProjectShellPath) - Len(ProjectName))
dim theCommand as String
theCommand = "rm -rf " + ProjectPath + appNameForShell
dim theResult as String
theResult = DoShellCommand(theCommand)
if theResult <> “” then print theResult
function getShellString(theString as String) as string
theString = ReplaceAll(theString, " ", "\ ")
theString = ReplaceAll(theString, “-”, “\-”)
theString = ReplaceAll(theString, “(”, “\(” )
theString = ReplaceAll(theString, “)”, “\)”)
return theString
end Function
[/code]
The second problem mentioned was eventually tracked down to a faulty plugin.
Thanks for your help.
Jim