Get the Application Name at run time

I searched (not enough), and I only found:

MsgBox "The name of the running Application is:" + EndOfLine + EndOfLine + Me.ExecutableFile.Name

who returns the application name (tested ony with El Capitan), but it is suffixed .debug while running in the IDE (but correct when running in the Stand Alone).

Is there’s a way to only get the application name while running in the IDE ?

Xojo 2015r1.

the app you’re running while debugging is suffixed with a .debug !
it’s the real name of the app !
you can check #if debugbuild and remove the .debug at the end if necessary

Thank you Jean-Yves.

Of course, in the IDE, but not in the StandAlone. Read last line.

[code] Dim AppName As String

// Avoid the “.debug” suffix in the IDE
If DebugBuild Then
AppName = ReplaceAll(Me.ExecutableFile.Name, “.debug”, “”) // Remove .debug
Else
AppName = Me.ExecutableFile.Name
End If[/code]

Then, I can create / access to the preferences folder using AppName (and not getting two folders)…

On Windows the debug name is different.
If you want easy access to your apps own ApplicationData folder pick up the TPSF module. It handles things for you.

NJP EDIT : added link to TPSF module

THANK YOU TIM !

I do not had time to check that project on Windows, yet.

Have a nice week-end all.

Emile,

Here’s a workaround for you, which should work whether you’re running in the IDE or standalone:

  1. In the IDE, go to Build Settings -> Shared.
  2. In the inspector, there is an editable string property called “Package Info”. If you’re not using it for anything else, set that to your app name.
  3. Refer to that string in your code thus:

[code]Dim AppName As String

AppName = App.PackageInfo[/code]

Simple but effective.

Cheers
Grant

Thanks Grant, I will investigate.