I’m working on a python script for a game (game content is not relevant here), but under a certain condition I need the script to open a folder in the form of the OS’s explorer window.
import subprocess subprocess.Popen('explorer "'+l.expandPath('//saves')+'"') # ex: Popen('explorer "C:\Users\Name\Desktop\saves\"')
I’m opening the /saves/ folder where the .blend is stored. I found this code on a website that mentioned it was for Windows, but didn’t say anything about compatibility with other operating systems. The code works fine for me (using Windows).
So I’m just curious, will this code work on other operating systems and properly open the specific directory in its explorer window? If it doesn’t, is there any other code anyone could suggest I use to open a folder path?