Re: Write to to resources location from another module
Eduard <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <[email protected]> |
There is a virtual filesystem in the app that is intended to access the
configuration files both jar based and user settings.
To my understanding of how a virtual filesystem works, you could
similarly create your own additional virtual filesystem that overlays
the resource directories in the jars and maps them to a folder in the
user directory in that application filesystem. You can then write to the
resource folders while existing content from the Jar is still accessible.
I hope this hint gets you in teh right direction
Eduard de Jong
Mark Wade wrote:
> Hmm., guess I should have thought a bit before I blurted, I'm real
> rusty on all this, I can't write to resources, there in jars, yes?
> I'll need to go about this differently I think, create the images
> differently, maybe ImageUtilities is not what I should use.
>
> If anyone does have any insight, however, what I'm trying to do is:
>
> I'm building an item in an inventory program from tables in a
> relational DB and one of the fields is a file name, ie foo.jpg. The
> images are stored in the OS's file system rather than in the DB as a
> blob or such, I just thought that was better, I know the path, I just
> need the file name from the DB. I've been entering this field using
> the DB's interface but I'm now trying to implement the functionality
> pragmatically. Rather than a wizard I implemented a custom dialog with
> DialogDescriptor that allows manual entry of the path(well, not yet)
> and a browse button that opens a JFileChooser. That selected file I
> then copy to a known location and then I have problems using
> ImageUtilities.
>
> Sorry to be so long-winded and thanks for the bandwidth,
>
> Mark Wade
>
> On 06/03/2016 04:23 PM, Mark Wade wrote:
>> Hello,
>>
>> I'm loading images using ImageUtilities.loadImage(String resourceID)
>> in a viewer module. In a separate editor module I'm trying to use a
>> filechooser dialog that can be used to select an image file which
>> would then be copied to that resource location. I tried to use
>> System.getProperty("user.dir") but that is not a resource and so
>> returns null.
>>
>> Can I get that particular module's class loader and get a path to
>> that resource location so that I can write an image file to it from
>> outside that module?
>>
>> -- Mark Wade
>>
>>
>
>