Jump to content
Sign in to follow this  
Gustav Schubert

How to detect App-Store config at runtime?

Recommended Posts

I want to determine at runtime whether the app was compiled in Normal configuration or Application-Store configuration.

 

Depending on this piece of info I plan to set my internal boolean IsSandboxed property.

 

  • True - show standard dialogs to choose file name.
  • False - read and save directly from/to a known filename according to convention.
{$if defined(IOS) or defined(Android)}
  // Mobile Apps are sandboxed, but my internal IsSandboxed flag needs to be false, ok.
  IsSandboxed := false; // do not show file name dialogs
{$endif}

{$ifdef MACOS}
  // OSX Apps are sandboxed, have permissions set
  IsSandboxed := true; // use dialogs
{$endif}

{$ifdef MSWINDOWS}
  // I myself (dev) don't want to be bothered with the dialogs.
  IsSandboxed := false; // Normal configuration
{$endif}

// pseudo code follows, does not work
{$if defined(MSWINDOWS) and defined(Configuration == App_Store)}
  IsSandboxed := true; // for Windows Store, play it safe, earn full_trust.
{$endif}


( So far I have been reluctant to rename my IsSandboxed property. )

 

But what is the best way to know if my App runs in Application-Store config vs. Normal config?

 

This question applies to VCL apps as well as FMX apps.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×