Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

File.openWithDefaultApplication() to open directory not working from release build

New Here ,
Nov 24, 2010 Nov 24, 2010

Hi,

I'm trying to use the File.openWithDefaultApplication() method to open a directory location.  I'm running on Windows 7 Professional 64-bit, but have also tested on Windows XP Professional 32-bit with the same result.

The method works fine if I run the app from Flash Builder 4 (either run or debug), but when I try it from a release build it doesn't work.  I've exported the release build as a native installer, and I updated the <supportedProfiles> tag in the app's XML to only support "extendedDesktop".  That hasn't changed the behavior, however.

Here's an example of how I'm calling the method:

        var thedir:File = File.applicationStorageDirectory;
        thedir = thedir.resolvePath("the_directory");
        if (!thedir.exists)
          {
          thedir.createDirectory();
          }
        thedir.openWithDefaultApplication();

Any idea what's going on?

As an aside, if I try to open individual files in the release build, it works fine.  So far only opening a directory is a problem.  And, I verified the directory exists before trying to open it.

Thanks for any insight you can offer...

Best,

Chris

TOPICS
Performance issues
2.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Dec 01, 2010 Dec 01, 2010

Hi Chris,

Instead of using openWithDefaultApplication(), try using native process and calling "explorer" on windows, and "open" on mac, then pass the folder path as an argument.  Something like this windows example:

private function openWindowsFolder():void {      var explorer:File = new File("C:\\Windows\\explorer.exe");            if (explorer.exists)      {           var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();           nativeProcessStartupInfo.execut

...
Translate
Adobe Employee ,
Dec 01, 2010 Dec 01, 2010

Hi Chris,

Instead of using openWithDefaultApplication(), try using native process and calling "explorer" on windows, and "open" on mac, then pass the folder path as an argument.  Something like this windows example:

private function openWindowsFolder():void {      var explorer:File = new File("C:\\Windows\\explorer.exe");            if (explorer.exists)      {           var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();           nativeProcessStartupInfo.executable = explorer;                      var args:Vector.<String> = new Vector.<String>();           args.push("C:\\Windows");           nativeProcessStartupInfo.arguments = args;           process = new NativeProcess();           process.start(nativeProcessStartupInfo);      } }

Hope this helps,

Chris

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 06, 2010 Dec 06, 2010

Thanks, Chris.  That worked!

Best,

Chris

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 13, 2014 Jan 13, 2014
LATEST

What would be the equivalent on a Mac of:

var explorer:File = new File("C:\\Windows\\explorer.exe");

Where is 'open' ?


I realize this is a little old, so thanks in advance if anyone is listening.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines