From: Domenico De F. <dom...@gm...> - 2011-05-04 18:28:58
|
Hi, That's exactly what I'm doing, but unfortunately it doesn't work. Do you think I need to set any particular configuration in the XMLVM project or to put my files in another folder? Also, I don't understand why I don't need to add the "res/" to the path when loading images using the UIIMage. I know it depends on the fact that when I created the project I set that folder as the one containing the resources, but I don't clearly see the connection. Thanks, Domenico On 4 May 2011 19:37, Panayotis Katsaloulis <pan...@pa...> wrote: > > On May 4, 2011, at 7:06 PM, Domenico De Fano wrote: > > Hi all, > > I'm encountering a problem while reading files from my java2objc > application. I have a number of files stored in a res > folder of my project which I set in the configuration file as to be the > resources folder. > When I try to load icons I use in the application, using the UIImage class, > everything works fine. > If I try to read files using the FileInputStream class, I need to specify > the absolute file path, or there is no way the files can be found. > I couldn't understand why this happens, thus, I looked into the Objective-C > compatibility libraries for the implementation of the classes. Following the > FileInputStream implementation, > I ended up in the java_io_File.m class, and the following method: > > - (void) __init_java_io_File___java_lang_String: (java_lang_String*) > pathname > { > if (pathname==JAVA_NULL || [pathname length] == 0 || [pathname > characterAtIndex:0] != '/') { > // For relative paths, prepend the base directory of > <App>/Documents/ > // > http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/FilesandNetworking/FilesandNetworking.html > NSArray *paths = > NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, > YES); > path = [[NSMutableString alloc] init]; > [path setString:[paths objectAtIndex:0]]; > [path appendFormat:@"/%@", pathname]; > } else { > path = [[pathname copyWithZone: NULL] retain]; > } > } > > Which appends my file path to the Documents base directory of the app. How > should I set the relative path for files located > in a resources subfolder? > > Thanks > > > Probably I didn't understand the question, byt why not prepend the "res/" > part before the filename? > > > ------------------------------------------------------------------------------ > WhatsUp Gold - Download Free Network Management Software > The most intuitive, comprehensive, and cost-effective network > management toolset available today. Delivers lowest initial > acquisition cost and overall TCO of any competing solution. > http://p.sf.net/sfu/whatsupgold-sd > _______________________________________________ > Xmlvm-developers mailing list > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlvm-developers > > -- Domenico De Fano |