Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adobe AIR and different OS filesystems

Another Adobe Air question for you but first here some background into the project I have been tasked with. It is an AIR app that will read assets from a USB key and must work on both WIN and MacOS. The problem is, how do I load assets into the app on MacOS! Sounds simple enough and works seamlessly on Windows.

Here is a code snippet of what i am trying to do:

            var loader:Loader = new Loader(); 
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ok);
            loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);

            var p:String;

            if (os == "mac")
            {
                p = "/Volumes/" + keyVolume.rootDirectory.name + File.separator + "0a0ff0ff-f7ae-4b9c-9637-843b1d6c80e8.jpg";
            }
            else
            {
                p = keyVolume.rootDirectory.name + File.separator + "0a0ff0ff-f7ae-4b9c-9637-843b1d6c80e8.jpg";
            }

            var temp:File = new File(p);
            Debugger.Display.text += "\nAttempting to load: " + p;
            Debugger.Display.text += "\nDoes it exist? " + temp.exists;
            loader.load(new URLRequest(p));

... the variable OS and keyVolume are being successfully set in earlier code. Also, I have the event listener callbacks defined as well for ok() and ioErro().

When this is run it prints out on windows:

Attempting to load: G:\0a0ff0ff-f7ae-4b9c-9637-843b1d6c80e8.jpg
Does it exist: true

... and then successfully loads the asset.

On MacOS, it prints out:

Attempting to load: /Volumes/AC/0a0ff0ff-f7ae-4b9c-9637-843b1d6c80e8.jpg
Does it exist: true

... and then fails with an IOError every time.

Can anyone see something that I am missing here? Do I have some sort of permission error or something (file has "read / write" access). The USB key is formatted in MS-DOS FAT32, could that be a problem?

EDIT

I formatted a new USB key in MacOS to FAT16 and put the files onto it with no success. Problems remain.

EDIT

I am now just trying to load an asset from /users/-USERNAME-/Desktop and still am receiving the same error, so it looks like it isn't a permissions issue on just the USB stick, it is more widespread than that.

EDIT

PROBLEM SOLVED! I finally worded my Google search correctly and it revealed the answer.

These changes will fix the problem:

            var loader:Loader = new Loader(); 
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ok);
            loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);

            var p:String = keyVolume.rootDirectory.nativePath + ((os == "mac") ? File.separator : "") + "0a0ff0ff-f7ae-4b9c-9637-843b1d6c80e8.jpg";
            var temp:File = new File(p);
            Debugger.Display.text += "\nAttempting to load: " + temp.url;
            Debugger.Display.text += "\nDoes it exist? " + temp.exists;
            loader.load(new URLRequest(temp.url));

I have also refined the logical statement involving the OS detection a bit as well.

I hope someone finds this useful!

like image 257
nokturnal Avatar asked Feb 05 '11 01:02

nokturnal


People also ask

What is Adobe AIR and do I need it on my Mac?

Adobe AIR is a computer program known as a runtime. It is necessary to have Adobe AIR on your computer to run certain applications. Applications that require Adobe AIR are called Adobe AIR applications. Most Adobe AIR problems are related to having the correct version of Adobe AIR.

Can you still use Adobe AIR?

Adobe will provide basic security support – limited to security fixes only for desktop platforms (Windows 7 and above, and Mac OS X) – for Adobe AIR v32 until the end of 2020. After that time, Adobe support for AIR will be discontinued and ongoing support will be managed by HARMAN and communicated by them directly.

Is Adobe AIR the same as Adobe Flash Player?

Adobe AIR runs on the same technology as Flash (i.e. your AIR apps will run in the Flash player.) The difference is the additional libraries available in AIR to allow you to more easily create Rich Internet Applications, as opposed to Flash itself which is targeted at animation and games creation.

What is Adobe AIR and do I need it on my computer?

Adobe® AIR® is a multi-operating system, multi-screen runtime that allows you to leverage your web development skills to build and deploy rich Internet applications (RIAs) to the desktop and mobile devices.


1 Answers

PROBLEM SOLVED! I finally worded my Google search correctly and it revealed the answer.

These changes will fix the problem:

            var loader:Loader = new Loader(); 
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ok);
            loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);

            var p:String = keyVolume.rootDirectory.nativePath + ((os == "mac") ? File.separator : "") + "0a0ff0ff-f7ae-4b9c-9637-843b1d6c80e8.jpg";
            var temp:File = new File(p);
            Debugger.Display.text += "\nAttempting to load: " + temp.url;
            Debugger.Display.text += "\nDoes it exist? " + temp.exists;
            loader.load(new URLRequest(temp.url));

I have also refined the logical statement involving the OS detection a bit as well.

I hope someone finds this useful!

like image 59
nokturnal Avatar answered Oct 31 '22 16:10

nokturnal