aseprite / aseprite/api

Add API for sprite/file timestamps

Open
#174 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
307
Forks
68
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing scripting API documentation and the APIs around events and app.fs mentioned in the issue. Define how sprite.lastSaved, sprite.lastOpened, and the filesystem timestamps behave, including unsaved files and timestamp comparison; done means the requested values are exposed consistently across supported platforms.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.