I'm a programmer working on a MacBook Pro with only 256 GB of disk. In the past, I spent dozens of dollars a year on CleanMyMac to help me clean up my disk. Until one day, when I wanted to upgrade the system to 12.x, I found that the disk was not enough, so I couldn't upgrade. I used CleanMyMac to clean my disk thoroughly, but there is not enough space. After analysis, it was found that the development tools and the compilation results left over from many projects took up a lot of disk space. At that time, I wrote a shell script to clean up, and as a result, 30GB of disk space was recovered, and the system was successfully upgraded.
This shell script is not very easy to use for most people, so I thought that I could develop a software to help me do the garbage cleanup. So I wrote this software in Rust.
Before writing the software, I listed a few core functions to meet the cleanup needs of both regular and developer users.
- Clean up the runtime cache and logs of regular software and system software.
- Clean up the runtime cache and logs of the build tools used in software development.
- Clean up the compilation results of software development that can be retrieved from the source code, etc.
- Easy to use, scans very few files and protects user privacy to the maximum extent.
Why choose Rust as a development language?
PrettyClean doesn't just use Rust, our client interface is written using TypeScript + React. I think the cleaning of the development tool cache and code compilation cache is not only reflected on the macOS system, but also developers who use Linux or Windows system programming have the same cleaning needs, so cross-platform is my first consideration.
Another aspect is the desire to compile binaries so that users can use PrettyClean directly without having to install the runtime separately.
In fact, during the development process, I found that Rust has much more advantages as a generative tool. For example, when cargo handles dependencies, it does not need to spend a lot of energy on dependency management like Java projects. version compatible.
Why choose Tauri as a development framework?
Once the main development language is determined, the choice of development frameworks will be much smaller, and it will be easier to make a good choice according to your own situation. After a period of research, basically two technical frameworks have been determined, which are:
These two frameworks are very good cross-platform application frameworks. Finally, I chose to use TypeScript + React to build the GUI interface logic according to my actual situation, and use Rust to implement the background core logic of the application. I had Java Swing development experience before, and it was a bad experience. At present, I think HTML + JS is the best interface development model, so I gave up iced, and Tauri became my best choice.
Tauri uses a multi-process model. An application is divided into a core process and a WebView process. This model brings us several additional benefits:
- The robustness of the program is improved, and when any unexpected things happen to the core process or the WebView process, it will not affect each other.
- Based on the IPC mode, the program has better security, and each process is assigned the minimum permissions enough to complete the work to limit the damage scope of potential vulnerabilities.
The robustness and security of the program are my top concerns for the application, and Tauri is a good match for my real needs.
Of course, this is only a small part of Tauri's many advantages. For example, I use its other features in the development process to solve several typical problems:
- The size of the installation package is very small. The size of the PrettyClean installation package is less than 6MB. On the one hand, it reduces the network consumption of CDN and on the other hand, it makes it easier for users to download it.
- Use Tauri Updater to allow users to update applications cheaply.
- Use the Tauri Event function to implement interface switching, etc.
The above are the main reasons why I built PrettyClean, and some of the great experiences I have had with Rust and Tauri.