Long time no see! It’s Yan here, creator of Marta. Hope you stay safe in these crazy times.
Today I’m happy to announce the release of Marta 0.8. While it doesn’t bring a lot of new features, it’s packed up with internal changes made to allow for the bright future of Marta.
File System Layer
File system layer is the core of a file manager, so it needs to be stable, performant, and extensible. While the old implementation didn’t have major bottlenecks, and it proved to be working without significant changes during the past several years, it still wasn’t ideal in many aspects:
- File abstraction was complex and depended on a particular file system. Moreover, each individual file was represented by a heap object, making unnecessary burden on Swift memory management;
- Too much information about files was collected without a particular reason at times;
- File system could be accessed from the UI thread, making it easier to introduce an interface freeze.
While I could address each of these issues separately, it would have probably resulted in even more mess with numerous adapters and proxies. That’s why I decided to rewrite the whole file system layer from scratch with the experience I got through these years. It took tremendous efforts – almost every part of Marta had to be changed in some way. However, I’m thrilled with the result.
- File abstraction became much lighter, file system-agnostic – and now it’s kept in stack.
- Marta now gathers only the required file information, and at the predictable moment.
- All file operations are guaranteed to be done in background. It brings more stability and even more snappy UI.
- It became much easier to support new file systems.
The refactoring also fixed a few limitations that the old implementation had, for instance, issues with navigation across symbolic link boundaries. Now, when you enter a symlinked directory, Marta won’t jump you to the original folder location. You can navigate through symbolic links as if they were ordinary folders.
Together with the file system layer, async operations (Copy, Delete, Move to Trash, and so on) were rewritten from the ground up as well. Not only the old code depended much on the old file system API, but it was also naive at times and didn’t support a lot of cases.
Lua API Changes
As you might imagine, such a global refactoring couldn’t leave aside the API Marta offers. But there’s good news – the new API became much more straightforward and safe. There were several major changes:
- The
File
type now exposes all file operations a file system offers. - All continuous operations are automatically run in the worker thread. You don’t have to switch threads by yourself, though – Marta will do it for you. When you call a suspending method (such as
File.makeFolder
), the Lua script will suspend and resume when the result is ready. All such methods are marked with a Suspends tag. - Instead of throwing errors, methods than can fail return multiple results. For example,
File.readText
returns an error and a string. Before you had to wrap throwing calls withpcall()
, now it’s a matter of checking a result value nullability.
Download
As always, you can grab the latest version of Marta from the download page.
If you already use Marta, click “Marta” → “Check for Updates” to get the latest version.
You can find the complete list of changes in the changelog.
New Landing Page
Together with the Marta itself, the web site also got some improvements.
First of all, there’s now a fully-fledged landing page that describes Marta functionality and highlights some of its strengths. Although it might be a bit humble, it’s a way better than a screenshot alone. I was continuously suggested to add a proper landing, so here it is!
Also, all type references in Lua API documentation are now clickable. It made navigation across the API surface much more pleasant. By the way, I’ve also added one more tutorial – Using MoonScript. Check it out!
Finally, I moved the web site to Netlify, a static web site hosting that offers fast CDN. It should significantly speed up page loading, wherever you live. As people who like Marta come from all over the world, I want to give them equally lighting-fast web experience.
In the meantime, I plan to update the documentation, splitting it to several sections. Although a single page was enough when I started the project, it’s impossible to cover all the details while keeping it pretty. I hope you’ll like it!
Don’t cough and use Marta! ☀️