codenameone - getAppHomePath() seems to throw a wrong path in Simulator? -
i have problem getapphomepath() method, 1 returns "file://home/" in debugger, afterwards filenotfoundexception.
code throws exception:
filename = "100004_2016-06-29.jpg" apphomepath = filesystemstorage.getinstance().getapphomepath(); img = image.createimage(storage.getinstance().createinputstream(apphomepath + filename));
exceptionmessage:
java.io.filenotfoundexception: c:\users\xyz\.cn1\file___home_100004_2016-06-29.jpg (das system kann die angegebene datei nicht finden)
so seems adds prefix "file___home_" corrupts path, have file "100004_2016-06-29.jpg" stored under path.
the snippet creates file under path below:
img = image.createimage(filesystemstorage.getinstance().openinputstream(filepath)); outputstream os = storage.getinstance().createoutputstream(newfilename); imageio.getimageio().save(img, os, imageio.format_jpeg, 1.0f);
the filepath variable returned imagegallery, under %temp%.
anyway storing file works, reading somehow not.
am missing or there bug in simulator code?
the problem mixed usage of storage & filesystemstorage 2 different classes. unfortunately simulator maps storage
same location maps filesystemstorage
need fix avoid such cases.
you need pick 1 api , use that. imageio
works filesystemstorage
need absolute files that.
Comments
Post a Comment