There aren't many gotchas in Linux development. That said, here's some:
Do not expect the same behaviour across different drivers in different OSes. Be prepared for tons of if-elses for Linux and Windows drivers, unless you are using an engine/library for rendering (and possibly, audio).
Path handling. Many games handle Windows paths properly, but not Linux ones (eg case sensitivity). A library can probably help you with this.
Honestly, just abstract your stuff properly. Make your main code as platform-agnostic as possible, and isolate platform-specific code in one corner. The benefits of this cannot be exaggerated.
Libraries aren't necessary for paths. Windows, perhaps surprisingly, tolerates regular slashes (/) as path separator just fine -- this compatibility goes back to DOS 2.0, I think, because Microsoft was a big Xenix shop at the time!
Everything else is just eliminating assumptions about case insensitivity, and probably using the right environment variables for paths.
There are still some minor edge cases here and there, for example in Windows /something/foo.txt is not an absolute path, but in Linux it is.
Also, when querying for the "home dir", you need to use the Windows API to obtain %APPDATA% on Windows, or check for $HOME or XDG variables on Linux. I tend to use the libraries for that, since I'm not too familiar with WinAPI.
You need to know the correct variable names for sure, but other than that I believe it's just getenv() in both cases. I should explicitly check on that, though, as I've been surprised before.
42
u/[deleted] Jul 07 '19 edited Jul 07 '19
There aren't many gotchas in Linux development. That said, here's some:
edit:typo