Skip to content

Commit

Permalink
installer fix Linux Documents folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Die4Ever committed Oct 10, 2023
1 parent 3cb103b commit 291403f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 10 additions & 5 deletions installer/Install/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,19 @@ def GetSourcePath() -> Path:
raise RuntimeError('failed to GetSourcePath()', p)


def GetSteamPlayDocuments(system:Path) -> Path:
if 'Steam' in system.parts:
idx = system.parts.index('Steam')
p = system.parents[-idx -1] # parents array is backwards
info('GetSteamPlayDocuments() == ', p)
p = p /'steamapps'/'compatdata'/'6910'/'pfx'/'drive_c'/'users'/'steamuser'/'Documents'
info('GetSteamPlayDocuments() == ', p)
return p

def GetDocumentsDir(system:Path) -> Path:
if not IsWindows():
if 'Steam' in system.parts:
idx = system.parts.index('Steam')
p = system.parents[idx]
info('GetDocumentsDir() == ', p)
p = p /'steamapps'/'compatdata'/'6910'/'pfx'/'drive_c'/'users'/'steamuser'/'Documents'
info('GetDocumentsDir() == ', p)
p = GetSteamPlayDocuments(system)
Mkdir(p, True, True)
else:
p = Path.home()
Expand Down
4 changes: 4 additions & 0 deletions installer/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
@typechecked
class DXRTestCase(unittest.TestCase):
def test_documents(self):
system = Path('/home/deck/.local/share/Steam/steamapps/common/Deus Ex/System/')
d = Install.GetSteamPlayDocuments(system)
self.assertEqual(d, Path('/home/deck/.local/share/Steam/steamapps/compatdata/6910/pfx/drive_c/users/steamuser/Documents/'), 'GetSteamPlayDocuments')

d = Install.GetDocumentsDir(Path.home())
self.assertTrue(d.exists(), str(d) + ' exists')

Expand Down

0 comments on commit 291403f

Please sign in to comment.