Skip to content

Add API for sprite/file timestamps #174

Description

@Arecher

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
Image
  • 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions