My first thought for why things fails is the the Environment.SpecialFolder don’t map, and thus I found this page talking about it
So I ran the code on my Windows XP box and got:
Desktop C:\\Documents and Settings\\spilgrim\\Desktop Programs C:\\Documents and Settings\\spilgrim\\Start Menu\\Programs Personal C:\\Documents and Settings\\spilgrim\\My Documents Personal C:\\Documents and Settings\\spilgrim\\My Documents Favorites C:\\Documents and Settings\\spilgrim\\Favorites Startup C:\\Documents and Settings\\spilgrim\\Start Menu\\Programs\\Startup Recent C:\\Documents and Settings\\spilgrim\\Recent SendTo C:\\Documents and Settings\\spilgrim\\SendTo StartMenu C:\\Documents and Settings\\spilgrim\\Start Menu MyMusic C:\\Documents and Settings\\spilgrim\\My Documents\\My Music DesktopDirectory C:\\Documents and Settings\\spilgrim\\Desktop MyComputer Templates C:\\Documents and Settings\\spilgrim\\Templates ApplicationData C:\\Documents and Settings\\spilgrim\\Application Data LocalApplicationData C:\\Documents and Settings\\spilgrim\\Local Settings\\Application Data InternetCache C:\\Documents and Settings\\spilgrim\\Local Settings\\Temporary Internet Files Cookies C:\\Documents and Settings\\spilgrim\\Cookies History C:\\Documents and Settings\\spilgrim\\Local Settings\\History CommonApplicationData C:\\Documents and Settings\\All Users\\Application Data System C:\\WINDOWS\\system32 ProgramFiles C:\\Program Files MyPictures C:\\Documents and Settings\\spilgrim\\My Documents\\My Pictures CommonProgramFiles C:\\Program Files\\Common Files
and on my MacBook I get
Desktop /Users/parents/Desktop Programs Personal /Users/parents Favorites Startup Recent SendTo StartMenu MyMusic /Users/parents/Music DesktopDirectory /Users/parents/Desktop MyComputer Templates ApplicationData /Users/parents/.config LocalApplicationData /Users/parents/.local/share InternetCache Cookies History CommonApplicationData /usr/share System ProgramFiles MyPictures /Users/parents/Pictures CommonProgramFiles
One question raised on that page is why are there two Personal values, and it’s because MyDocuments is the second Enumeration, but .ToString() only names the first in order of an enum set.
So the mystery deepens as I’m using
Environment.SpecialFolder.Personal, and therefore it should work, but it seems to be failing to create the data directory, time to explore more…
After some a bit more playing around I found the file “SAVE/player.cha” in my Mac folder structure, and realised I was doing string concatenation with DOS slashes, etc. hard coded all over the place, so I refactored the code, and now it saves/loads files fine.
I then created a Mac .app bundle, so you can now just download form Google Code the Mac OS X version of the game, un-tar/gzip it, and as long as you have Mono installed, tada, instant game action. Albeit slow…
Only problem to solve is that the save files are case sensitive, in how they are searched and managed, and I’ve not got a standard schema in place. I may have to build some wrapper code to manage this, so odd DOS/Windows casing works fine on Mac/Linux systems.
Also I’ll have to make a Linux tar ball for those Linux/Mono people to test play with.