How to create a build script to remove a file

I use Valentina but not the libvreport_fat_release.dylib in my app. It’s 7 MB, so I’d like to remove it with a build script. I’ve based it on another build script posted on the forum that removes unwanted languages .lproj folders, but I keep getting a “no such file or directory” error. The path it seems OK to me. Can anyone tell me what’s wrong with this script?

dim dest as string
dest = CurrentBuildLocation + “/” +CurrentBuildAppName + “.app/Contents/vcomponents”

dim cmd as string
cmd = "/rm -rf " + dest + “/”

dim theOutput as string
theOutput = doshellcommand(cmd + “libvreport_fat_release.dylib”)

if theOutput <> “” then print theOutput

do you have this step before BUILD or after BUILD ?
if its before then that makes sense as it does not exist in the build location before the build
it would after

Good thought, but this script is the last one that is run (Build is the first). It comes after the Install Valentina script.

Why don’t your remove the file in the original Valentina build script? As far as I remember you just need to comment out the line with the report dylib.

If don’t want to change the Valentina script do a print to see the path of the file you want to delete.

I did modify the script (and there are many lines that need commenting out), but that caused problems with the latest build of Valentina. I thought this would be a less intrusive way (and I could use any new Valentina scripts without modification). I have looked at the pathname and it seems fine to me. But bash is extremely finicky, which is why I ask the question here.

What’s the value of dest?
If either your current path, or CurrentBuildAppName have a space in it, you may be confusing rm on the next line as spaces need to be escaped.

I usually do those nasty shell commands in the terminal first and then I build the command piece by piece in Xojo with lots of prints.

Stupid question: why are you using a slash in front of the rm here? "/rm -rf "

Thanks to you both for answering. It was indeed the /rm that was the problem (I had copied it from another script that deleted files post-build). When I removed the slash the file was found and removed properly. Again, thanks for your help.