I made a quick Sprite Reload plugin, and I was hoping to be able to add something to automatically reload a file if it was edited externally. For this, I'd need to store the last saved timestamp for each Aseprite file using events, and retrieve the last modified timestamp from the OS for the file, and see whether the last modified > last saved. While possible with io.popen, this causes CMD popups, requires additional user permissions and the platform dependent commands would make this difficult to do.
Therefore I'd love for the following to be added:
sprite.lastSaved : Returns a timestamp for the last time the sprite was saved using Aseprite. When not saved since opening, should return sprite.lastOpened, when no saved, should return nil or 0.
sprite.lastOpened : Returns a timestamp for when this file was last opened using Aseprite
app.fs.created(filepath) : Returns the timestamp for when the originally created
app.fs.lastModified(filepath) : Return the timestamp for the last modification that was made to the file on disk.
app.fs.lastAccessed(filepath : Returns the timestamp for the last time this file was accessed on disk
I don't quite see the utility of the last one, but since it's one of the main data timestamps that Windows provides, having access to it might be useful to someone someday!
I'm unsure on what the best format for the timestamps would be, but making it easy/possible to compare them would be useful.
I made a quick Sprite Reload plugin, and I was hoping to be able to add something to automatically reload a file if it was edited externally. For this, I'd need to store the
last savedtimestamp for each Aseprite file usingevents, and retrieve thelast modifiedtimestamp from the OS for the file, and see whether thelast modified>last saved. While possible withio.popen, this causes CMD popups, requires additional user permissions and the platform dependent commands would make this difficult to do.Therefore I'd love for the following to be added:
sprite.lastSaved: Returns a timestamp for the last time the sprite was saved using Aseprite. When not saved since opening, should returnsprite.lastOpened, when no saved, should returnnilor0.sprite.lastOpened: Returns a timestamp for when this file was last opened using Asepriteapp.fs.created(filepath): Returns the timestamp for when the originally createdapp.fs.lastModified(filepath): Return the timestamp for the last modification that was made to the file on disk.app.fs.lastAccessed(filepath: Returns the timestamp for the last time this file was accessed on diskI don't quite see the utility of the last one, but since it's one of the main data timestamps that Windows provides, having access to it might be useful to someone someday!
I'm unsure on what the best format for the timestamps would be, but making it easy/possible to compare them would be useful.