Codemagic: How to Use a Custom Folder for FVM Config?

Yauheni Pakala
2 min readAug 19, 2023

If you’re using Codemagic for your Flutter app builds, you might have come across the need to configure the Flutter version using FVM (Flutter Version Management). Codemagic makes use of the fvm_config.json file located at the root of your project in the .fvm directory to determine the Flutter version. However, what if your .fvm folder is not in the usual location? What if you've organized your project a bit differently? In this post, I'll show you how to handle this scenario.

The Usual Setup

Normally, Codemagic automatically looks for the fvm_config.json file in the .fvm directory at the root of your Flutter project. This setup is ideal if you've structured your project in a standard way. But what if you have a custom project structure and your .fvm folder is located somewhere else? Changing the working directory won't help you in this case.

Using Symbolic Links (Symlinks)

Fortunately, there’s a clever solution that allows you to maintain your custom project structure and still make everything work seamlessly with Codemagic. The solution involves using symbolic links, also known as symlinks.

What are Symbolic Links?

A symbolic link is a reference to a file or directory located at a different path. It acts like a shortcut that redirects you to the actual target file or directory. This can be incredibly useful for scenarios where you want to maintain multiple access points to the same content.

Creating a Symbolic Link for Your .fvm Folder

Let’s assume that your .fvm folder is located in a subdirectory called sources. You can create a symbolic link from the standard location (root of your project) to your custom location using a simple terminal command.

Open your terminal and use the ln -s command, followed by the original path of your .fvm folder and the desired link location. Here's an example command:

ln -s sources/.fvm .fvm

In this example, sources/.fvm is the original path of your .fvm folder, and .fvm is where the symlink will be created. This symlink effectively tells Codemagic that the .fvm folder is still at the root of your project, even though it's actually in the sources subdirectory.

Conclusion

With this simple symlink trick, you can keep your custom project structure while making Codemagic recognize the location of your .fvm folder correctly. Symlinks provide a powerful way to create flexible connections between different parts of your project, enabling you to customize your setup without sacrificing compatibility.

So, the next time you find yourself needing to use a custom folder for your FVM configuration in Codemagic, remember to harness the power of symbolic links.

Happy coding!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Yauheni Pakala
Yauheni Pakala

Written by Yauheni Pakala

I’m a software engineer. I’m a fan of technology, cross-platform development, and programming.

No responses yet

Write a response