3dcheapskate opened this issue on Apr 23, 2020 ยท 38 posts
structure posted Sat, 25 April 2020 at 9:10 AM Forum Coordinator
as an0malaus said PrefsLocation is the best place to store config data
config = os.path.join(poser.PrefsLocation(), "3DCheapskate", "scriptname" )
if not os.path.exists( config )
os.makedirs( config )
config = os.path.join( config, scriptname.data )
poser.TempLocation and poser.PrefsLocation are not subject to the UAC -
as adp pointed out "A running script inside Poser looks like Poser is doing something (same process, because Poser-Python is an integral component of Poser). Means: your script is able to write to all places Poser can."
however to check if UAC is a potential problem ( for writing anything to poser.Applocation ) # not usually a good idea to store config data here
def is_running_as_admin():
'''
Checks if the script is running with administrative privileges.
Returns True if is running as admin, False otherwise.
'''
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
from sys import platform
if platform == "win32":
import ctypes
if is_running_as_admin():
appLoc = os.path.dirname( poser.Applocation() ) # Poser Main Directory
# --- create alternative storage folder ---
else:
drive = "c:/"
appLoc = os.path.join(drive,"Temp","Runtime","Libraries","pose" ) # build your path here
if not os.path.exists( appLoc ): # check folder exists
os.makedirs( appLoc ) # build folder if it does not exist
Locked Out