Environment Switching
Flowork consists of thousands of lines of code unified across three layers. Running the raw source code and running the final packaged executable are completely different operational states.
How The Engine Knows
The Go engine uses clever path-sniffing. When executing go run main.go, Golang actually compiles a temporary binary deep inside the user's AppData/Local/Temp/go-build folder and runs it.
The engine reads its own location using os.Executable(). If the string "temp" or "go-build" is present, it assumes it is a developer.
When Dev Mode is true:
- The Auto-Updater is skipped entirely.
- File writes read the local repository directory, rather than locking to the
exefolder. - Additional diagnostic endpoints may be exposed.
How Electron Knows
Electron relies on the boolean app.isPackaged. When developers run npm start, this is false. When the build:portable script finishes packaging gui.exe, this becomes true.
When false:
- The
FloworkDatafolder is instantiated inside the repository source structure. - When true, it is instantiated parallel to the
.exelocation ensuring complete portability on user systems.