An installed AIR app is not supposed to reside in bin-debug.
You can use File.applicationStorageDirectory, File.desktopDirectory,
File.documentsDirectory... with resolvePath().

thomas parquier
---
http://www.web-attitude.fr/realisations/
msn : thomas.parqu...@web-attitude.fr
softphone : sip:webattit...@ekiga.net <sip%3awebattit...@ekiga.net>
téléphone portable : +33601 822 056


2010/4/16 Davis Ford <davisf...@zenoconsulting.biz>

>
>
> Hi, so I am using FlashBuilder 4, and I'm using FlexUnit4 to create unit
> tests.
>
> For some tests I need to load a file as input. I can't seem to load a
> file from a relative path. All the air examples have you use the
> static defined places and want you to navigate from there (e.g.
> File.documentsDirectory), but this isn't really a good option for
> running unit tests.
>
> My project structure is the standard Flex layout.
>
> Let's say I have this:
>
> src/assets/file.txt
>
> When the project builds, this is copied into
>
> bin-debug/assets/file.txt
>
> The .swf that has the test runner also executes from bin-debug, so why
> can't I do this:
>
> var file:File = new File("assets/file.txt");
>
> When I do, it throws an exception. Same thing if I try
>
> var file:File = new File();
> file.nativePath = "assets/file.txt";
>
> Interestingly enough, I can load this file using URLLoader, but that
> seems to be the only way. It seem bizarre that URLLoader works, but
> File does not, unless I am missing something?
>
> Regards,
> Davis
>  
>

Reply via email to