Can't drag and drop more than ten files from OS file manager to Aseprite in Linux

Aseprite v1.2.40-x64
Linux Mint 21.2 Cinnamon 64-bit

This was reported earlier in late 2019 and early 2023 on different distributions here:

It may have to do with file and path handling differences between Windows and Unix-like OS’s. Maybe an enumeration issue where 0-9 works but 10 fails due to unexpected formatting/parsing of double-digit indices…hell if I know.

In any case, there is no Ctrl-A to select all files or holding Shift to select a range of files in the Aseprite file dialog, meaning the only way to reasonably open a large number of files is a drag and drop operation, which of course is limited to ten files.

I have updated Aseprite via Steam to v1.3.5-x64 and the issue still occurs.

@OneProngBent @LilyLilac

1 Like

In my case it fails on the 6th file, located in /home/leyn/Projects/Project shortcuts/pico sonic/TMPL 02 - Sonic 2D Tech demo/Backup/tilemap backups/tilemap backup 2021-07-11.

The selected file names are:

stage_region00.map.png
stage_region01.map.png
stage_region10.map.png
stage_region11.map.png
stage_region20.map.png

The error message:

shows that even the parent folder name is truncated.

I have a hypothesis: all the file paths are concatenated into a huge string. The longer the path to each file, and the more files there are, the longer the final string. At some point the final string reaches its max length and is truncated, making further file import fail.

Each filename full path is in the format:
/home/leyn/Projects/Project shortcuts/pico sonic/TMPL 02 - Sonic 2D Tech demo/Backup/tilemap backups/tilemap backup 2021-07-11stage_regionXX.map.png which takes 149 characters. There is probably some separator character which would make 150 characters.

There are 6 files which would makes 150*6=900 characters. “tilemap backup” ends 33 characters before the end. So following this hypothesis, the limit would be around 867 total characters (sounds weird, not a power of two or anything).

Anyway, there’s probably something to check on that side.

Nice work @hsandt, sounds like you’re a fellow programmer by your post. :slight_smile:

I noticed at the top of this forum it says to reports bugs inside the program. Strangely I can see nowhere do actually do that in the program, so I’m going to try to email their support team. I’ll post here if anything happens.

Until then, if anyone else can test this or already knows they’re experiencing the issue, please drop a “me too” here with your Aseprite version and OS. This bug’s been around for at least five years now. :frowning:

Hi there, I wasn’t able to reproduce it dropping files from the Desktop, so probably is something related to long paths. It willl need some extra tests.

About Linux a few words: This is the worst platform to program apps, we have the lowest % of users here, distros/WMs made a mess to integrate apps here, and X11 is a super bug-prone API. Even all that, we try our best to progress on this area.

This is the first time I saw this bug report (missed the 2019 one). I think that dropping a lot of files in the app is not such a common use case.

@dacap Awesome, thanks David for taking a look at it. I just cloned the repo to take a look at it myself but have no idea where to start. :confused: I did find something suspicious in file_selector.cpp under app/ui, “# define MAX_PATH 4096 // TODO this is needed for Linux, is it correct?” I’m guessing that was just added after this bug report. Anyway, I can poke around if I know what files to look at that handle the drag and drop operations for the main UI. I don’t know C++ but have a lot of experience with other languages.

Thanks for giving a try to the code. I think the bug should be located here:

My guess is that the data must be read in chunks, a similar issue we had when we copy & paste data between apps:

Indeed, I tried to open the files via the Open file popup and multi-select and I didn’t have the issue as with drag-and-drop. So it may really be a window interaction thing rather than a pure file path management thing.

EDIT: And for Linux / X11 support, we’re grateful you still put some time on it, to be honest my biggest issue was the laggy Preview popup move and that has been fixed, it’s much more pleasant to use Aseprite on Linux (at least X11) now!

1 Like