Couldn't you set File url property from UrlRequest url property ? --- 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 Thomas, yes, I get that, but this isn't a deployed application...this is > running a FlexUnit4Runner that tests methods in various As3/M2MXML classes > running inside the project. > > I don't want to install the app to run unit tests, and I don't want to have > to have my test data deployed in a directory like File.documentsDirectory or > some variation thereof, b/c this is not project portable for developers. > > I should just be able to reference a file inside the project itself using a > relative path...and it seems bizarre to me that the File class itself is > unable to do so, despite the documentation showing examples that it can be > done. > > I can work around it using URLLoader, but I'm just curious if anyone else > has encountered this. > > > On Fri, Apr 16, 2010 at 9:06 AM, thomas parquier < > mailingli...@web-attitude.fr> wrote: > >> >> >> 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 >>> >> >> > > > -- > Zeno Consulting, Inc. > home: http://www.zenoconsulting.biz > blog: http://zenoconsulting.wikidot.com > p: 248.894.4922 > f: 313.884.2977 > > >