Page 1 of 1

Deleting .app file

Posted: Sun Jul 04, 2021 8:56 am
by hrcap
Hi Guys

I hope that you are all having a good weekend.

I wonder if anyone could shed some light on the following please: I have my standalone saved on my desktop on Mac. The path to the standalone is:

/Users/user1/Desktop/Eample.app

When running the following script it returns 'can't delete that file'.

I have ensured that the Example.app file is not running and is closed.

Code: Select all


on mouseup

   put specialfolderpath(desktop) into t_pre
   set the defaultfolder to t_pre
   
   
   put t_pre & "/" & "Example.app" into t_file_delete
      
      
   -- attempt 1
   delete file t_file_delete
   put the result
   
   
   -- attempt 2
   delete file specialFolderPath(desktop) & "/Example.app"
    put the result
   
   -- attempt 3
   delete folder t_file_delete
    put the result
   
   -- attempt 4
   delete URL ("file:" & t_file_delete)
    put the result
   
   ---
   
end mouseup



Many Thanks

Hadleigh

Re: Deleting .app file

Posted: Sun Jul 04, 2021 11:32 am
by jmburnod
Hi,
Same result here (OS X 10.14.6, LC 9.6.1, file unlocked read and write allowed)
I never needed to delete a livecode.app file.
I'm curiose to know why you need this.
Best regards
Jean-Marc

Re: Deleting .app file

Posted: Sun Jul 04, 2021 11:40 am
by hrcap
Hi Jean Marc

Thanks for looking in to this.

I am making an Uninstaller to delete the App and its supporting files.


*Update
I have also now tried changing the file name within the script to remove the '.app' suffix to see if this would allow the delete, but again no luck.


Any further help from anyone would be appreciated.


Many Thanks

Re: Deleting .app file

Posted: Sun Jul 04, 2021 5:26 pm
by FourthWorld
A Mac app bundle isn't a file, it's a folder.

Re: Deleting .app file

Posted: Sun Jul 04, 2021 5:46 pm
by hrcap
Hi Richard

Thank you, I have also tried the delete folder command, but to no avail.


Many Thanks

Hadleigh

Re: Deleting .app file

Posted: Sun Jul 04, 2021 6:00 pm
by jacque
You can't delete a folder unless it's empty, you need to remove all its contents first. Try the revDeleteFolder command, it does that for you.

Re: Deleting .app file

Posted: Sun Jul 04, 2021 6:05 pm
by jmburnod
Thanks Jacque

Code: Select all

revDeleteFolder t_file_delete
works :D
Best regards
Jean-Marc

Re: Deleting .app file

Posted: Mon Jul 05, 2021 12:28 pm
by hrcap
Thanks Jacque

That has also worked for me :D

Every day is a school day



Many Thanks