Can I move .platformio folder to another partition/drive?

The .platformio folder is taking up a lot of space on my C drive and still growing bigger as I’m adding libs and extensions to the IDE. I was wondering if I can move it to another drive.

See Master User folder in home_dir - #3 by garvamel, one can define a new system environment variable PLATFORMIO_HOME_DIR to the path of where the .platformio folder should be globally (docs), or one can set it per-project using the home_dir option in the platformio.ini file of the project (docs)

Update for PlatformIO 4:

It’s now called PLATFORMIO_CORE_DIR (docs).

Also see Redirecting....