eivindveg / HotSUploader

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

[Mac, 10.10.5] Doesn't detect replay until after match is finished #160

Open macspoof opened 7 years ago

macspoof commented 7 years ago

The replays aren't detected until after the match completes, so I never see the in progress window to show stats of people or links to their accounts. Upon checking the normal HotS replay folder for the user: /Users//Library/Application Support/Blizzard/Heroes of the Storm/Accounts//1-Hero-1-/Replays the file doesn't exist there until the match is completely ended. Uploads after the match is over do work correctly.

This has been broken since the patch notes said it was fixed a version or two ago, but I hadn't seen the problem until the fix went in. I've tried re-installing the uploader as well as wiping the directory above in case there were too many files (many thousands), but have not yet gotten HotS Replay Uploader to show the in game teams.

HotS Replay Uploader v2.1.5 Mac OS X 10.10.5

macspoof commented 7 years ago

I've found the replays, as they are in progress prior to being copied. They exist at: /Users/<username>/Library/Caches/TemporaryItems/Blizzard/Heroes of the Storm There ends up being a Files directory and a TempWriteReplayP2 directory there.

The TempWriteReplayP2 directory goes away once you get to the Summary screen and contains: replay.attributes.events replay.server.battlelobby replay.game.events replay.smartcam.events replay.load.info replay.sync.events replay.message.events replay.sync.history replay.resumable.events replay.tracker.events

The Files directory contains the StormSave files, listed such as: <hex number>.StormSave.<number>replay.* where * is: attributes.events game.events load.info message.events resumable.events smartcam.events sync.events tracker.events

macspoof commented 7 years ago

This fixes it for me, and should not affect higher versions of Mac OS X, as they will continue to use the updated java.ip.tmpdir version. If 10.11 based systems also use the older style (I'm on 10.10), then simply adjust the compare to 12 instead of 11.

In src>main>java>ninja>elvind>hotsreplayuploader>services>platform>OSXService.java at line 93, defining BattleLobbyTempDirectories

    @Override
    public BattleLobbyTempDirectories getBattleLobbyTempDirectories() {
        final File root;
        final File remainder;

        /* Get 10.x.y OS version and compare the .x portion to adjust behavior of temp folders */
        String sysVersion = System.getProperty("os.version");
        if (Integer.parseInt(sysVersion.split("[.]")[1]) < 11) {
            root = new File(USER_HOME, "Library");
            remainder = new File(USER_HOME + "/Library/Caches/TemporaryItems/Blizzard/Heroes of the Storm");
        }
        else {
            root = new File(System.getProperty("java.io.tmpdir"));
            remainder = new File(root + "/TemporaryItems/Blizzard/Heroes of the Storm");
        }
        return new BattleLobbyTempDirectories(
            root,
            remainder
        );
    }
zhedar commented 7 years ago

Thanks for your report und your work to look into this issue. I wasn't really able to test it on much older versions and therefore couldn't really track the course for this change down. :(

As you've mostly solved it, would you be interested to open a Pull Request so we can incorporate your proposed changes?

macspoof commented 7 years ago

Please just incorporate it as you see fit. It is basically just the old and the new way of doing things both still there. If you already have a version check mechanism in place, you may want to use that instead of my quick hack of a version check. Glad I could help.

zhedar commented 7 years ago

I finally picked this issue up, but was unsuccessful to actually set up old versions of OS X to properly test this. I think I just need to implement it in good faith and hope we don't break things.

Maybe I can even implement a fallback, which checks both paths.

Just to be curious, are you still on 10.10 and might want to check what echo $TMPDIR yields in Terminal?

macspoof commented 7 years ago

Still on 10.10, though may not be able to stay there too much longer (HotS now officially pops up the “Old OS won’t stay supported long” warning dialog on every run). I’ll probably be on it until I can’t be. I think the fallback idea is good, as then you don't need to version check, just go until you find the appropriate temp dir with Blizzard HotS files.

$TMPDIR
-bash: /var/folders/qx/qcs_<random string here>/T/: is a directory