3rd Party Module Dev
- Jan 2, 2020
Examples on how to ask paths from the operating system.
Strict Import mojo2 Import os Function Main:Int() New myGame Return 0 End Function Class myGame Extends App Field canvas:Canvas Field folderpath:String Method OnCreate:Int() canvas = New Canvas() SetUpdateRate 0 ' In macOS and Windows you can write "set" in the terminal and get ' a list of environment variables that you may access using GetEnv() and SetEnv(). ' ' Examples ' ' The examples are tested only on macOS if not stated otherwise. ' folderpath = GetEnv("HOME") ' folderpath = GetEnv("PATH") ' folderpath = GetEnv("SHELL") ' folderpath = GetEnv("USER") ' get usename in macOS folderpath = GetEnv("USER") + "/Music" ' you can replace Music with Movies Pictures Documents Applications Downloads Desktop 'folderpath = GetEnv("USERPROFILE") + "\Music" Windows-10/11-version of above Return 0 End Method OnRender:Int() canvas.Clear canvas.DrawText folderpath,16,16 canvas.Flush Return 0 End End