Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions qcloudcli/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,25 @@ def __init__(self, configWriter=None):
self.home = ".qcloudcli"
self.configure = "configure"
self.credentials = "credentials"
self.qcloudConfigurePath = os.path.join(self.findConfigureFilePath(),
self.home)
self.parser = handleParameter.handleParameter()

def showQcloudConfigurePath(self):
configurePathName = ".qcloudcli"
sysHomePath = ''
if 'Windows' in platform.system():
sysHomePath = os.environ['HOMEPATH']
else:
sysHomePath = os.environ['HOME']
pass
qcloudConfigurePath = os.path.join(sysHomePath, configurePathName)
if os.path.isdir(qcloudConfigurePath):
return qcloudConfigurePath
if 'Windows' not in platform.system():
systemWideConfigurePath = '/etc/qcloudcli'
if os.path.isdir(systemWideConfigurePath):
return systemWideConfigurePath
return qcloudConfigurePath

def getConfig(self, profilename=None):
if profilename is None:
profilename = 'default'
Expand Down Expand Up @@ -63,10 +78,10 @@ def _getConfigFromFile(self, config, profile, filename):
j = j+1

def getConfigFileName(self):
return os.path.join(self.qcloudConfigurePath, self.configure)
return os.path.join(self.showQcloudConfigurePath(), self.configure)

def getCredsFileName(self):
return os.path.join(self.qcloudConfigurePath, self.credentials)
return os.path.join(self.showQcloudConfigurePath(), self.credentials)

def findConfigureFilePath(self):
homePath = ""
Expand Down
10 changes: 1 addition & 9 deletions qcloudcli/handleCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,7 @@ def showQcloudCliHelp(self):
"know the module corresponding actions." % (self.red, self.end))

def showQcloudConfigurePath(self):
configurePathName = ".qcloudcli"
sysHomePath = ''
if 'Windows' in platform.system():
sysHomePath = os.environ['HOMEPATH']
else:
sysHomePath = os.environ['HOME']
pass
qcloudConfigurePath = os.path.join(sysHomePath, configurePathName)
return qcloudConfigurePath
return self.globalConfigure.showQcloudConfigurePath()

def getAllmodules(self):
site_packages_path = get_python_lib()
Expand Down