Deploy Console with Desktop on macOS

  1. 7 days ago

    Chris O

    Nov 6 Pre-Release Testers, Xojo Pro

    Hi

    I want to take advantage of multi-core when I can - Does anyone know of the best way to deploy Console apps with the DeskTop for the end user (ie. on an installer)

    Thanks

    Simply import the built console app folder with a build script into your resources folder and launch it from there in a shell. Like here in a thread to keep it alive and responsive:

    Dim helperpath As FolderItem = SpecialFolder.Resources.Child("HelperAppFolder").Child("HelperApp.exe") // macOS without ".exe"
    If helperpath <> Nil And helperpath.exists Then
      Dim sh As New shell
      sh.mode = 1
      sh.TimeOut = 60
      sh.Execute join(Array (helperpath.ShellPath, ListOfAnyOtherVariablesYouWantToPass), " ")
      While sh.IsRunning
        t.Sleep 50
      Wend
    End If
  2. Ulrich B

    Nov 6 Pre-Release Testers, Xojo Pro Answer Europe (Germany, Berlin) · xo...
    Edited 7 days ago

    Simply import the built console app folder with a build script into your resources folder and launch it from there in a shell. Like here in a thread to keep it alive and responsive:

    Dim helperpath As FolderItem = SpecialFolder.Resources.Child("HelperAppFolder").Child("HelperApp.exe") // macOS without ".exe"
    If helperpath <> Nil And helperpath.exists Then
      Dim sh As New shell
      sh.mode = 1
      sh.TimeOut = 60
      sh.Execute join(Array (helperpath.ShellPath, ListOfAnyOtherVariablesYouWantToPass), " ")
      While sh.IsRunning
        t.Sleep 50
      Wend
    End If
  3. Chris O

    Nov 6 Pre-Release Testers, Xojo Pro

    Thanks very much Ulrich!

  4. Markus W

    Nov 6 Pre-Release Testers, Xojo Pro #JeSuisHuman Germany, Heidelb...

    See http://www.tempel.org/RB/MultiProcessing

  5. Chris O

    Nov 6 Pre-Release Testers, Xojo Pro

    Thanks Markus, Paul Lefebvre has a pretty good post here to:

  6. 6 days ago

    Daniel F

    Nov 7 Pre-Release Testers, Xojo Pro Germany

    In order to debug such helper apps I use the remote Debugger in a virtual machine, and tell the remote Debugger not to start the application. You can then start the apps manually and your main app can start the helper app with activated remote debugger.

  7. Sam R

    Nov 7 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan

    @Ulrich B Simply import the built console app folder with a build script into your resources folder and launch it from there in a shell. Like here in a thread to keep it alive and responsive:

    Not the "Resources" folder, only non-executable items should be stored there.
    https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW19

    Executable code should be in either "MacOS", "Frameworks" or "Helpers" folders.

    I've been assisting an App Wrapper customer, who'se having problems once his application is "Hard", and one of the problems is trying to access a dylib stored in the "Resources" folder of his application.

  8. Chris O

    Nov 7 Pre-Release Testers, Xojo Pro

    Thanks Sam - Thought Ulrich had found me a way :-)

    So could you include the helper and dylib files in the project as files and then do something like this:

    dim f as FolderItem=SpecialFolder.ApplicationData.Child("Test")
    if f.Exists=False then
      f.CreateAsFolder
    end if
    if f.Child("Shell Libs").Exists=False then
      f.Child("Shell Libs").CreateAsFolder
    end if
    
    dim op as TextOutputStream=TextOutputStream.Create(f.Child("Helper"))
    if op=nil then Return
    op.Write shell1
    op.Close
    
    
    op=TextOutputStream.Create(f.child("Shell Libs").Child("rbframework.dylib"))
    if op=nil then Return
    op.Write rbframework
    op.Close
    

    And launch helper when required?

  9. Ulrich B

    Nov 7 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    You could also just change the build script to move the app into the frameworks folder.

  10. Sam R

    Nov 7 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan

    @Chris O'Brien So could you include the helper and dylib files in the project as files and then do something like this:

    May I ask what you're trying to accomplish?

    How I choose to do it with HDRtist NX, is to include the console applications in the "/Contents/MacOS/" folder.

    Then when it's time, I launch it from there. Search the forum for TPSF (Tim's special folder extensions) as this module should help you find the executables in your bundle.

    Also note, that you if you want to ship this application on the mac App Store, you have to use a NSTask instead of the shell to launch the helpers.

  11. 5 days ago

    Chris O

    Nov 8 Pre-Release Testers, Xojo Pro

    Thanks Sam. Basically I have some DB housekeeping that needs to be done after users do certain tasks, but is not time critical so doing them asynchronously is grand. I'm trying to avoid having a server app to do these as it complicates deployment.

    I'll give your suggestion a go...

    Thanks for your time.

    Chris

or Sign Up to reply!