Problem Description
[quote:q63961jp]This might be a bit difficult to explain, because it makes little sense. But it appears that when you use NWjs to open an image and load it into a sprite using "load image from url", but at the same time copy the file to a new destination and tell it to use that one instead. And then load a new image it still uses the old image despite it doesn't exist anymore. Guess it might read it from memory maybe?
************************* NEW *****************************
Sorry that I reopen this again and that it gets a bit messy, but its a bit confusing when these bug reports are just closed, without even being tested.
You wrote that this could be a workaround:
[quote:q63961jp]There is a workaround though: load a different image in between. If you load "image.png", then load "dummyimage.png", then load "image.png", it will really load it again since the URL has changed every time.
However I should have tested it to see if it worked. But now I ran into the problem once more and since the original bug report was closed and no answer to my question in it, I kind assumed that it wouldn't/will be fixed.
So I tried the workaround that you suggested and it doesn't work. The image is stuck in memory or whereever it is stored until the application is restarted.
This is crucial for my program that this is possible and im starting to run out of idea of creating workarounds for this, except having to redesign my program yet again based on all these weird limitations.
So please reconsider my suggestion in the original post:
[quote:q63961jp]Wouldn't it be possible to simply duplicate the "Load image from URL" and make one called "Load image from disk" which forces update and if you need to use it for web you use the first one and if its from the disk where internet speed is not an issues you can use the other one?
Or some other way, don't really care how its done, Maybe as someone suggested in the "General" section, something that will force it to clear memory or something. I can see the idea of not having to load images all the time. But what is point of keeping stuff in memory that doesn't even exist anymore.
*************************************************************
Added from old post
[quote:q63961jp]'Load image from URL' is asynchronous: the action only starts it working, and it completes later when 'On image URL loaded' triggers. During the loading you synchronously copy and overwrite the file that is currently being loaded. This effectively makes it random which image you load, depending on which the system manages to do first: read the file, or copy the file over it. Further reading and writing to C:\ normally requires admin permissions on most systems, which C2 games don't run with by default.
If you still think there is a problem, please file a new bug report that has a clearly ordered sequence of operations, and doesn't attempt to read or write files to/from system locations that normally require admin permissions to access.
[quote:q63961jp]UPDATE:
I have moved the files to my users folder and the files are copied only in this directory. And the problem is the same. I think you might have misunderstood the problem as its a bit weird to explain. But you write that it "depends on which the system manages to do first".
But its not relevant in this case, because the two things are not happening at the same time.
Meaning, between the copy and actually using the URL from where it was copied to, I can wait 5-10 seconds or whatever before I even tell it to use that path, and it will still load the old image even though that image have been deleted from the hard disk. Also the files are 1.85kb in size, so it should be more or less instant regardless.
The problem happened when you do it exactly the way I descripted in the old post, but ill try to explain it again.
Attach a Capx
https://dl.dropboxusercontent.com/u/109921357/Load%20image%20from%20file%20bug.capx
Description of Capx
Allows you to select a jpg file and load it into a sprite. At the same time copying the file to "C:\Users\<Name>\Test\Test.jpg" Right clicking the image will load the image from C:\Users\<Name>\Test\Test.jpg.
Steps to Reproduce Bug
1. Double click one of the images and select a jpg file. The two images now uses the image selected through the chosenpath. At the same time a copy of the file is copied to "C:\Users\<Name>\Test\Test.jpg".
2. Right click one of the images to use the URL "C:\Users\<Name>\Test\Test.jpg".
3. Double click one of the images and select another jpg files than in step 1. The images now changes to this file as expected.
4. Right click one of the images again to use the URL "C:\Users\<Name>\Test\Test.jpg" However instead of using the image from step 3, it uses the image from step 1, even though it is not at that URL anymore, and the image from step 3 is in that location it doesn't load it.
Expected Result
That it would read the file from the path its told and not from maybe memory.
Affected Browsers
Don't know.
Operating System and Service Pack
Windows 7
Construct 2 Version ID
r202