Xojo Build Automation/IDE Scripting

yeah the build twice is because by the time the prebuild script is running most things have been “baked in”
So your first build uses the old name, the script runs & alters it, then the second uses the newly altered name
Could probably get around that by an IDE script (not a build script) that sets the name then just calls “build” and that then causes the external script to run

1 Like

There’s where IDECommunicator might still be useful.
The IDECommunicator just has 2 commands:

  1. Change name of App
  2. Build App (which runs the external script)

Thanks, @npalardy !

So what’s all this malarky in the Communicator’s FindIPCPath method?

Dim parent As FolderItem

Try
  parent = Volume(0).Child("tmp")
Catch err As NilObjectException
  parent = Nil
End Try

If parent Is Nil Or Not parent.exists Or Not parent.IsWriteable Then
  // Handle WUBI installed Ubuntu (is really odd and Volume(0) fails)
  Try
    parent = Volume(0).Child("var").Child("tmp")
  Catch err As NilObjectException
    parent = Nil
  End Try
End If

If parent Is Nil Or Not parent.exists Or Not parent.IsWriteable Then
  // Handle WUBI installed Ubuntu (is really odd and Volume(0) fails)
  Try
    parent = SpecialFolder.Temporary
  Catch err As NilObjectException
    parent = Nil
  End Try
End If

If parent Is Nil Or Not parent.exists Or Not parent.IsWriteable Then
  // Handle WUBI installed Ubuntu (is really odd and Volume(0) fails)
  Try
    parent = SpecialFolder.Home
  Catch err As NilObjectException
    parent = Nil
  End Try
End If

Try
  Const ipcpath = "XojoIDE"
  Return parent.Child(ipcpath).ShellPath
Catch err As NilObjectException
  Return ""
End Try

Why can’t we just use:

Dim parent As FolderItem = GetTemporaryFolderItem

Try
  Const ipcpath = "XojoIDE"
  Return parent.Child(ipcpath).ShellPath
Catch err As NilObjectException
  Return ""
End Try

Because it doesn’t work in some configurations (as noted in the comments)
IF you dont care about those configurations then remove that an compact your code

I guess what I’m getting at is why wouldn’t the GetTemporaryFolderItem work in every case? (Oddly, it doesn’t work on my Mac! - why?)
Why is Volume(0) chosen instead of just a random temp file?

… as noted in the comments …

sometimes it didnt
why ?
because the installation, config set up gave no temporary when using the proper API (as in GetTemporaryFolderItem)
why ?
no clue but wubi didnt
and the other code DID work

so thats whats there

I’m going to need a better explanation, I can’t just let something like this go! :wink:
Are you saying that GetTemporaryFolderItem doesn’t actually create a FolderItem sometimes?

Where would I dig in to find out more about this?

Yes
You really cant dig into it any more as GetTemporaryFolderItem is a C/C++ function inside Xojo and without the source code you cant see why it might have failed sometimes
It just did - mostly when WUBI was installed - as mentioned in t he comments

Right. Except it’s failing on my Mac.
No idea what WUBI is!

GetTemporary is FAILING on your mac ???
Never run into that

WUBI is/was a set up for linux

I changed the miles of code to:

Dim parent As FolderItem = GetTemporaryFolderItem

Const ipcpath = "XojoIDE"
Return parent.Child(ipcpath).ShellPath

And no workie.

I thought it was failing to create a temporary folder, but that’s not it. It creates a temporary folder, but when using that the IPCSocket doesn’t work. No errors, just nothing happens when IPCSocket.Send is called.
Nothing returns, no errors but nothing happens either.
It’s weird.