Mafia, Dropbox and Ubuntu

Lxndr

Member
I have mafia set up in my Dropbox. So, theoretically, all of its settings synchronize from one computer to another.

On my two windows computers, when I run Mafia from the fully-synchronized Dropbox folder, it seems to persist in settings - it remembers my usernames and passwords.

On my Ubuntu computer, this is untrue - it does not autopopulate my usernames and passwords.

What am I missing?
 

Veracity

Developer
Staff member
Linux and Macintosh do not look for scripts, settings, CCS files, etc. in the directory where you start KoLmafia.

Linux looks in ~/.kolmafia
Macintosh looks in ~/Library/Application Support/KoLmafia

If you always want to go to ~/Dropbox/KoLmafia, say, you could make ~/.kolmafia be a symbolic link to that directory.

Alternatively, when you start KoLmafia on Linux, add a commandline argument: -DuseCWDasROOT=true
... and it will behave the same as Windows.
 

Fluxxdog

Active member
Question: Why?

I'm not casting judgment, I'm just asking why this is. Windows usually uses %appdata% but that seems circumvented for Java. Is there a way to code mafia to use its . directory in the programming for all OS or must that be set by a command-line option?
 

lostcalpolydude

Developer
Staff member
Question: Why?

I'm not casting judgment, I'm just asking why this is. Windows usually uses %appdata% but that seems circumvented for Java. Is there a way to code mafia to use its . directory in the programming for all OS or must that be set by a command-line option?

Was %appdata% a standard in 2004 when holatuwol made the initial mafia thread in G-D (or even earlier, when it was likely coded before announcing it to people)? My guess is no, and that's why mafia stores things in the same folder as the jar/exe on Windows.

Changing things now would create issues with backward compatibility, I expect.
 

Veracity

Developer
Staff member
As a Mac user, I am extremely happy that I am not forced to use "." and be required to duplicate my scripts and preferences all over the place if I choose to run KoLmafia from different directories.
 

Fluxxdog

Active member
Was %appdata% a standard in 2004 when holatuwol made the initial mafia thread in G-D (or even earlier, when it was likely coded before announcing it to people)? My guess is no, and that's why mafia stores things in the same folder as the jar/exe on Windows.

Changing things now would create issues with backward compatibility, I expect.
No doubt. Not asking for a change, just learning the why.
As a Mac user, I am extremely happy that I am not forced to use "." and be required to duplicate my scripts and preferences all over the place if I choose to run KoLmafia from different directories.
What about if you carry it on a flash drive? I don't mean run it on a flash drive, I mean carry it with you to another computer to install and use. Do you have to install your scripts and preferences to the same user directory to have mafia run properly?

It seems KoLmafia wasn't designed with running the same account on different machines, though the option does seem to exist. At least, for non-Windows machines.
 

Veracity

Developer
Staff member
If you intend to install it from a flash drive and not run it from there, then yes, you presumably have to install preferences and scripts and such into the correct place.

It seems KoLmafia wasn't designed with running the same account on different machines, though the option does seem to exist.
Bingo.

At least, for non-Windows machines.
I don't understand this statement.
 
Last edited:

Winterbay

Active member
On Windows machines you can just install Mafia on the USB-stick and take it with you to whatever computer you want to run it on without any kind of fuzz. ON a amc/linus based system you cannot do that without faffing about copying different directories from different places.
 

Fluxxdog

Active member
OK, so I seem to understand this better now. Mac and Linux already had options for user settings at the time, so holatuwol used them. Windows didn't, so he used the folder you open mafia in. Is that right? I thought this was more an oddity with Java, but this is actually by design.
 
OK, so I seem to understand this better now. Mac and Linux already had options for user settings at the time, so holatuwol used them. Windows didn't, so he used the folder you open mafia in. Is that right? I thought this was more an oddity with Java, but this is actually by design.
You are correct on all your points. Windows doesn't really have a dedicated location for per-user settings, scripts, etc. so people make their own standards. I know this all too well since I make Java programs.
 

fronobulax

Developer
Staff member
If I recall Ancient History that I was present for, In The Beginning, Windows did not offer very good support for separating Programs and Data and different Data for different Windows accounts. One way to bypass all of this was to deliberately mix program and data in one directory. This allowed install instructions to be simple. Uninstall was as simple as deleting a single directory - (not looking for data or registry hacks). Directory permissions could be set so that All Users could read and write and folks were not especially concerned about malware finding the directory and changing something.

So, the one of the standard practices of the time for Java applications distributed as jar files was to just create a directory and run from it and store data there.

I will note that today this is still one of the preferred practices for portable applications that can be carried between Windows machines on removable storage and leave no traces of their presence on the host.

I'm not sure I recall enough to talk about which Windows features were by design and which were what they were because that was How You Do It In Windows.
 

Theraze

Active member
That works with dropbox, but not with USB-sticks. Or am I misunderstanding something?

Unless I badly misunderstand, which is always possible, running with that command makes it use your current folder as its storage folder for everything, whether that folder be on your USB drive, your Dropbox storage, or a random folder in your Home location. Or something completely different. You're just saying that your current location is the right spot to save things, making it just as portable on *nix based systems as it is on Windows.
 

Lxndr

Member
Alternatively, when you start KoLmafia on Linux, add a commandline argument: -DuseCWDasROOT=true
... and it will behave the same as Windows.

I just tried this.
My three multis usernames aren't in the drop-down.

Shouldn't that be happening?
 

lostcalpolydude

Developer
Staff member
Did you navigate to the folder and then try to run mafia, or was it something like "java -jar path/to/KoLmafia.jar"? The second case will place the folders in whatever folder you're currently at rather than in the folder that mafia is in.
 

Lxndr

Member
I set up a launcher (shortcut) on my desktop that launched "~/Dropbox/kolmafia.jar -DuseCWDasROOT=true"

That said, it still seemed to grab the settings that it would have had I not added "-DuseCWDasROOT=true" to it.
 
Top