Skip to content

Conversation

@dvd-bnc
Copy link
Member

@dvd-bnc dvd-bnc commented Sep 14, 2025

Implements the initial base for native filesystem methods, using GLib.

This implementation allows us to monitor progress for heavy operations, interface better with special folders (eg. Trash), get more info about files and the filesystem they reside on, display better errors and allow for cancellation, and many more other things.

This initial PR doesn't try to do much of the former, what it does though is lay out the foundation of such work, by trying to figure out a possible architecture for how dart code interfaces with native code, how threading between the IO thread and the main/platform dart thread works and so on.

This PR unfortunately (because of my own stupidity oop) includes other commits which are not closely related to this change, I recommend reviewers to mostly review the last commit (I apologize, I'll try to be more careful next time).

Some important things that are missing:

  • Proper memory and resource management
  • Displaying long running operations on the UI
  • Completely ditch out the dart:io methods in favor of the GLib ones, for example to implement file/directory watching
  • Proper build system support, as of now you need to build the zig library manually

There's the chance we'll need to migrate database solution, isar has been discontinued and for now I'm using the community fork, we'll need to discuss whether or not to migrate to another solution.

To test out the PR you'll need to be on linux, to have glib development libraries installed and to have zig 0.15.1 installed.
You'll also need to be on flutter main/beta with a recent version of flutter to run it because of the Native assets feature.
From then on you just cd into the src directory, run zig build and that should be enough to have the native lib ready.
After that you can run the files app by appending --enable-experiment=native-assets to flutter run/build, eventually the flutter command will tell you if you need to do something else

@dvd-bnc
Copy link
Member Author

dvd-bnc commented Sep 14, 2025

cc @larsb24 @Feichtmeier

@Feichtmeier
Copy link
Member

@dvd-bnc I can fix the pipeline after if it annoys you. I would add fvm and it's GitHub action as a replacement to the flutter subosito action if you are okay

@dvd-bnc
Copy link
Member Author

dvd-bnc commented Sep 14, 2025

by me it works fine yea, hopefully the native assets feature lands soon so we can continue using stable, maybe use beta so we don't have too many changes coming at once?

@@ -0,0 +1,191 @@
const std = @import("std");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for reviewers: ignore this file, it's my testing file to assert native behaviors, it'll get deleted in the future

@larsb24
Copy link
Member

larsb24 commented Sep 14, 2025

@dvd-bnc I can fix the pipeline after if it annoys you. I would add fvm and it's GitHub action as a replacement to the flutter subosito action if you are okay

(kinda ot from this pr) but I think we should generally give the whole repo a bit of an overhaul. The readme is also still full of mentions of dahliaos and even has a copyright claim for dahlia (obviously that's bs here and we should probably remove it)

@dvd-bnc
Copy link
Member Author

dvd-bnc commented Sep 14, 2025

(kinda ot from this pr) but I think we should generally give the whole repo a bit of an overhaul. The readme is also still full of mentions of dahliaos and even has a copyright claim for dahlia (obviously that's bs here and we should probably remove it)

definitely, this code is very old and in much need of some upgrades, from this kind of stuff (README, ci, etc) to actual code practices and libraries

Also remove progress display for dir fetch, it currently doesn't work
@dvd-bnc dvd-bnc merged commit 15e1554 into ubuntu-flutter-community:master Sep 15, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants