@@ -64,9 +64,11 @@ def get_auth_url_from_unity_logs():
6464 import tempfile
6565 import os
6666
67+ product_name = os .getenv ("UNITY_APP_NAME" , get_product_name ())
68+
6769 # Unity log file locations on Windows
6870 log_paths = [
69- os .path .join (os .path .expanduser ("~" ), "AppData" , "LocalLow" , "Immutable" , "Immutable Sample" , "Player.log" ),
71+ os .path .join (os .path .expanduser ("~" ), "AppData" , "LocalLow" , "Immutable" , product_name , "Player.log" ),
7072 os .path .join (tempfile .gettempdir (), "UnityPlayer.log" ),
7173 "Player.log" # Current directory
7274 ]
@@ -112,9 +114,11 @@ def get_logout_url_from_unity_logs():
112114 import tempfile
113115 import os
114116
117+ product_name = os .getenv ("UNITY_APP_NAME" , get_product_name ())
118+
115119 # Unity log file locations on Windows
116120 log_paths = [
117- os .path .join (os .path .expanduser ("~" ), "AppData" , "LocalLow" , "Immutable" , "Immutable Sample" , "Player.log" ),
121+ os .path .join (os .path .expanduser ("~" ), "AppData" , "LocalLow" , "Immutable" , product_name , "Player.log" ),
118122 os .path .join (tempfile .gettempdir (), "UnityPlayer.log" ),
119123 "Player.log" # Current directory
120124 ]
@@ -210,10 +214,13 @@ def handle_cached_authentication(driver):
210214 print ("CI environment - checking if authentication completed automatically" )
211215 print ("Monitoring Unity logs for authentication completion..." )
212216
217+ product_name = os .getenv ("UNITY_APP_NAME" , get_product_name ())
218+ log_path = os .path .join ("C:\\ Users\\ WindowsBuildsdkServi\\ AppData\\ LocalLow\\ Immutable" , product_name , "Player.log" )
219+
213220 auth_success = False
214221 for check_attempt in range (30 ): # Check for 30 seconds
215222 try :
216- with open ("C: \\ Users \\ WindowsBuildsdkServi \\ AppData \\ LocalLow \\ Immutable \\ Immutable Sample \\ Player.log" , 'r' , encoding = 'utf-8' , errors = 'ignore' ) as f :
223+ with open (log_path , 'r' , encoding = 'utf-8' , errors = 'ignore' ) as f :
217224 content = f .read ()
218225 # Look for signs of successful authentication
219226 if any (phrase in content for phrase in [
@@ -374,10 +381,13 @@ def login():
374381 print ("This means authentication was successful, just need to wait for Unity to process it" )
375382
376383 # Wait and check Unity logs for authentication success instead of relying on scene changes
384+ product_name = os .getenv ("UNITY_APP_NAME" , get_product_name ())
385+ log_path = os .path .join ("C:\\ Users\\ WindowsBuildsdkServi\\ AppData\\ LocalLow\\ Immutable" , product_name , "Player.log" )
386+
377387 auth_success = False
378388 for check_attempt in range (20 ): # Check for 20 seconds
379389 try :
380- with open ("C: \\ Users \\ WindowsBuildsdkServi \\ AppData \\ LocalLow \\ Immutable \\ Immutable Sample \\ Player.log" , 'r' , encoding = 'utf-8' , errors = 'ignore' ) as f :
390+ with open (log_path , 'r' , encoding = 'utf-8' , errors = 'ignore' ) as f :
381391 content = f .read ()
382392 # Look for signs of successful authentication in logs
383393 if any (phrase in content for phrase in [
@@ -539,9 +549,10 @@ def login():
539549 except :
540550 pass
541551
542- # Wait for the deep link dialog to appear and click "Open Immutable Sample.cmd"
552+ # Wait for the deep link dialog to appear and click the button
543553 # Use more specific selector to avoid clicking "Restore" button
544- deep_link_button = wait .until (EC .element_to_be_clickable ((By .XPATH , "//button[text()='Open Immutable Sample.cmd']" )))
554+ product_name = os .getenv ("UNITY_APP_NAME" , get_product_name ())
555+ deep_link_button = wait .until (EC .element_to_be_clickable ((By .XPATH , f"//button[text()='Open { product_name } .cmd']" )))
545556 deep_link_button .click ()
546557 print ("Clicked deep link permission dialog - Unity should receive redirect" )
547558 except Exception as e :
@@ -555,10 +566,12 @@ def clear_unity_data():
555566 """Clear Unity's persistent data to force fresh start"""
556567 print ("Clearing Unity persistent data..." )
557568
569+ product_name = os .getenv ("UNITY_APP_NAME" , get_product_name ())
570+
558571 # Clear PlayerPrefs from Windows Registry
559572 try :
560573 import winreg
561- registry_path = r "SOFTWARE\Immutable \Immutable Sample "
574+ registry_path = f "SOFTWARE\\ Immutable\\ { product_name } "
562575
563576 # Try both HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE
564577 for root_key in [winreg .HKEY_CURRENT_USER , winreg .HKEY_LOCAL_MACHINE ]:
@@ -577,7 +590,7 @@ def clear_unity_data():
577590
578591 # Clear Application.persistentDataPath
579592 try :
580- data_path = os .path .join (os .path .expanduser ("~" ), "AppData" , "LocalLow" , "Immutable" , "Immutable Sample" )
593+ data_path = os .path .join (os .path .expanduser ("~" ), "AppData" , "LocalLow" , "Immutable" , product_name )
581594 if os .path .exists (data_path ):
582595 import shutil
583596 shutil .rmtree (data_path )
@@ -705,26 +718,28 @@ def setup_protocol_association():
705718 """Set up immutablerunner:// protocol association to avoid permission dialogs"""
706719 print ("Setting up protocol association for immutablerunner://..." )
707720
721+ product_name = os .getenv ("UNITY_APP_NAME" , get_product_name ())
722+
708723 # PowerShell script to register the protocol
709- ps_script = '''
724+ ps_script = f '''
710725 # Register immutablerunner protocol
711726 $protocolKey = "HKCU:\\ Software\\ Classes\\ immutablerunner"
712727 $commandKey = "$protocolKey\\ shell\\ open\\ command"
713728
714729 # Create the registry keys
715- if (!(Test-Path $protocolKey)) {
730+ if (!(Test-Path $protocolKey)) {{
716731 New-Item -Path $protocolKey -Force | Out-Null
717- }
718- if (!(Test-Path $commandKey)) {
732+ }}
733+ if (!(Test-Path $commandKey)) {{
719734 New-Item -Path $commandKey -Force | Out-Null
720- }
735+ }}
721736
722737 # Set the protocol values
723738 Set-ItemProperty -Path $protocolKey -Name "(Default)" -Value "URL:immutablerunner Protocol"
724739 Set-ItemProperty -Path $protocolKey -Name "URL Protocol" -Value ""
725740
726741 # Find the Unity sample app executable
727- $sampleAppPath = "C:\\ Immutable\\ unity-immutable-sdk\\ sample\\ build\\ Immutable Sample .exe"
742+ $sampleAppPath = "C:\\ Immutable\\ unity-immutable-sdk\\ sample\\ build\\ { product_name } .exe"
728743 if (Test-Path $sampleAppPath) {
729744 Set - ItemProperty - Path $commandKey - Name "(Default)" - Value "`" $sampleAppPath `" ` "%1`" "
730745 Write-Host " Protocol association set up successfully "
0 commit comments