eivindveg / HotSUploader

JavaFX-based Replay Uploader for Heroes of the Storm
Apache License 2.0
185 stars 36 forks source link

Linux: wrong folder for accounts and does not see any replays to upload #38

Closed minlexx closed 8 years ago

minlexx commented 9 years ago

I'm running Gentoo Linux x86_64, Java info:

$ java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

Though you provide only debian .deb package, I just extracted .deb files and run it, and it runs OK! But it seems to choose wrong folder for HotS accounts. Here is program output:

$ hotslogsuploaderfx 
Attention! Linux is experimental and not official supported!
Detected Heroes of the Storm profile: /home/lexx/Heroes of the Storm/Accounts
Using Uploader directory: /home/lexx/HotSLogs UploaderFX
First run: assigning model version

Heroes of The Storm game works very fine using latest wine (1.7.52? i think, it does not matter) and it stores all information about user account and replays in the following folder:

ls -l "/home/lexx/Documents/Heroes of the Storm"
total 24
drwxr-xr-x 3 lexx lexx 4096 oct  3 01:01 Accounts
drwxr-xr-x 7 lexx lexx 4096 oct  6 00:35 GameLogs
drwxr-xr-x 2 lexx lexx 4096 oct  3 01:01 ImageUploads
drwxr-xr-x 2 lexx lexx 4096 oct  3 01:01 Interfaces
-rw-r--r-- 1 lexx lexx  955 oct  3 01:01 T_49071930_669@2.lnk
-rw-r--r-- 1 lexx lexx 1883 oct  5 22:58 Variables.txt

Particularly for my account, replays are stored in: /home/lexx/Documents/Heroes of the Storm/Accounts/105786634/2-Hero-1-2713863/Replays/Unsaved/Multiplayer/

Your program tries to use /home/lexx/Heroes of the Storm without Documents folder. But ok, I can just create a symlink, ln -s Documents/Heroes of the Storm

ls -l "Heroes of the Storm"
lrwxrwxrwx 1 lexx lexx 41 oct  6 01:51 Heroes of the Storm -> /home/lexx/Documents/Heroes of the Storm/

Now Hots Logs Uploader FX should find Accounts folder where it expects to? I run program again, but result did not change:

$ hotslogsuploaderfx 
Attention! Linux is experimental and not official supported!
Detected Heroes of the Storm profile: /home/lexx/Heroes of the Storm/Accounts
Using Uploader directory: /home/lexx/HotSLogs UploaderFX
Reading model version

This time the path is correct:

$ ls -l "/home/lexx/Heroes of the Storm/Accounts"
total 4
drwxr-xr-x 3 lexx lexx 4096 oct  3 01:02 105786634

But the result is: app screen

Accounts combo box does not expand, "Open Profile" button is disabled, no replays in replay lists. I would be fine with making symlinks, but then the program should accept them, even if it cannot detect the correct folder for hots accounts! :) Could there be a way to point program to account directly? Or if there were a bit more of debugging output, I could understand what went wrong :)

Lookup hero details and Lookup player functions are working fine.

Proof that I have replays actually there: replays screen

P.S. I know that Linux is experimental and not oficially supported, but it would be nice to have a true cross-platform uploader (official uploader uses windows executable, this one uses Java, so it should work!)

TheCherry commented 9 years ago

Hi, I will look for that issue later. On my system (Linux Mint) everything working fine, but my folder is /home/user/Heroes of the Storm/Accounts

minlexx commented 9 years ago

Maybe documents folder depends on wine settings (somewhere in winecfg -> integration -> folders), mine set to /home/user/Documents there. But anyway, why does not symlink work? I'll test it later, what happens if I remove symlink and just copy Heroes of the Storm directory from Documents to /home/user.

eivindveg commented 9 years ago

Symlink should work. If you just transfer directories, you Heroes of the Storm specific settings. I'll let TheCherry investigate this for a bit, otherwise I do have a stable Ubuntu and space to spare for a temporary Gentoo installation.

eivindveg commented 9 years ago

Did a quick check. Line number 85 in StormHandler.java should do some magic checking to see if that folder exists before simply appending. A quick and dirty fix might be using if(!new File(builder.toString, "/Heroes of the Storm/Accounts/").exists())

I'll prop up a workaround for testing.

eivindveg commented 9 years ago

No Gentoo just yet. Could you check if this build works? https://drive.google.com/open?id=0B1YR9l10StB3cVBDT0dWY0ZKWk0

minlexx commented 9 years ago

Thank you, I did some tests, and this test build works the same, except that it prints extra line in console:

Using OS profiles for: Linux if applicable.

After some tests I found that it does not matter symlink or not, this is not the matter. My guess is that if hotslogsuploader cannot find replays, it does not show available accounts. The matter is, that replays autosave is disabled in game settings, so /home/lexx/Heroes of the Storm/Accounts/105786634/2-Hero-1-2713863/Replays/Multiplayer/ folder is empty. BUT the game saves replays into /home/lexx/Heroes of the Storm/Accounts/105786634/2-Hero-1-2713863/Replays/Unsaved/Multiplayer/ anyway (note the Unsaved) folder in path. I don't know why it does so, but the fact is.. After copying replay files files from ...Replays/Unsaved/Multiplayer/ folder to ...Replays/Multiplayer/ everything seems to work fine (even with symlink). My expectation was that hotslogsuploaderfx knows about "Unsaved" folder :) so this issue now can probably be closed as invalid.

My suggestions are:

eivindveg commented 9 years ago

The branch the new artifact was built from has a fix for the latter, though not very elegant. I'll review the first point at least, bit unsure about the second.

eivindveg commented 8 years ago

Haven't fixed this yet, but as per a218dc3ccf2c795a7b017317b0526a2ec01ca80a, this should now be alot easier for others to review per case.

eivindveg commented 8 years ago

With the addition of per-platform services, we can now very easily query for these kinds of things and provide a proper fallback. Will be fixed as soon as I can get the battle.net launcher working on my desktop.

For anyone willing to participate a pull request, the service should do the following:

  1. Attempt to determine the distro to find out which command to execute in order to get the Documents directory
  2. Use that command to find the Documents directory
  3. If not a valid directory, fall back to a default
minlexx commented 8 years ago

The correct way to solve it would still be reading wine settings, which can be configured in winecfg program: http://i.imgur.com/q79m8h2.png Which can be done by reading links in ~/.wine/drive_c/users/$USER like shown here: http://i.imgur.com/fjuwjgb.png But shell folder names are localized by Wine, so for now I still don't know the proper way how to read it :) So, I guess the solution in the commit is fine, if it works, I will definitely test it.

Also about commit message "Further work should be done in the future by a developer who can actually get the Battle.net client working in Wine." - Battle.net client works in Wine just as is, at least from versions 1.7.54 up to current 1.8-rc1 (I'm building WIne from sources). No hacks required, no winetricks or something, it just works, also does the game (HoTS, StarCraft 2 also). There is only one bug bothering Battle.net launcher - https://bugs.winehq.org/show_bug.cgi?id=33943 ( see https://appdb.winehq.org/objectManager.php?sClass=version&iId=28855 )

eivindveg commented 8 years ago

Tried with 1.7.55. No luck. Unsure what's causing it as I have had multiple different issues(depending on what I tried to solve it).

The good news is that with a platform specific service handling paths now, all the heavy lifting required is located isolated in one place; if I can't get a proper environment up for testing, hopefully someone else who has can look into it.

Leaving this closed for now, but will look into it if not solely to play my favourite game in a gnome shell. Feel free to reopen if the current, albeit simplistic, fix proves inadequate.