本文整理汇总了Python中pyaid.system.SystemUtils.SystemUtils.move方法的典型用法代码示例。如果您正苦于以下问题:Python SystemUtils.move方法的具体用法?Python SystemUtils.move怎么用?Python SystemUtils.move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyaid.system.SystemUtils.SystemUtils
的用法示例。
在下文中一共展示了SystemUtils.move方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _move
# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import move [as 别名]
def _move(self, source, destination):
if not SystemUtils.move(source, destination):
print 'FAILED TO MOVE: %s -> %s' % (source, destination)
return False
print 'MOVED: %s -> %s' % (source, destination)
return True
示例2: _createEngineJs
# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import move [as 别名]
def _createEngineJs(self):
cb = CoffeescriptBuilder(
'sflow.api.SFlowApi-exec',
FileUtils.createPath(StaticFlowEnvironment.rootResourcePath, '..', 'js', isDir=True),
buildOnly=True)
target = cb.construct()[0]
targetFolder = FileUtils.createPath(
StaticFlowEnvironment.rootResourcePath, 'web', 'js', isDir=True)
result = SiteProcessUtils.compileCoffeescriptFile(target.assembledPath, targetFolder)
if result['code']:
print 'ERROR: Failed compilation of the Static Flow engine'
print result
return False
sourcePath = FileUtils.createPath(targetFolder, target.name + '.js', isFile=True)
destPath = FileUtils.createPath(targetFolder, 'engine.js', isFile=True)
SystemUtils.move(sourcePath, destPath)
return True
示例3: _handleReplaceDatabase
# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import move [as 别名]
def _handleReplaceDatabase(self):
self.mainWindow.showLoading(
self,
u'Browsing for Database File',
u'Choose a valid database (*.vcd) file')
defaultPath = self.appConfig.get(UserConfigEnum.DATABASE_IMPORT_PATH)
if not defaultPath:
defaultPath = self.appConfig.get(UserConfigEnum.LAST_BROWSE_PATH)
path = PyGlassBasicDialogManager.browseForFileOpen(
parent=self,
caption=u'Select Database File',
defaultPath=defaultPath)
self.mainWindow.hideLoading(self)
if not path:
self.mainWindow.toggleInteractivity(True)
return
# Store directory for later use
self.appConfig.set(
UserConfigEnum.DATABASE_IMPORT_PATH,
FileUtils.getDirectoryOf(path) )
self.mainWindow.showStatus(
self,
u'Replacing Database File',
u'Removing existing database file and replacing it with selection')
sourcePath = getattr(Tracks_Track, 'URL')[len(u'sqlite:'):].lstrip(u'/')
if not OsUtils.isWindows():
sourcePath = u'/' + sourcePath
savePath = '%s.store' % sourcePath
try:
if os.path.exists(savePath):
SystemUtils.remove(savePath, throwError=True)
except Exception as err:
self.mainWindow.appendStatus(
self, u'<span style="color:#CC3333">ERROR: Unable to access database save location.</span>')
self.mainWindow.showStatusDone(self)
return
try:
SystemUtils.move(sourcePath, savePath)
except Exception as err:
self.mainWindow.appendStatus(
self, u'<span style="color:#CC3333;">ERROR: Unable to modify existing database file.</span>')
self.mainWindow.showStatusDone(self)
return
try:
SystemUtils.copy(path, sourcePath)
except Exception as err:
SystemUtils.move(savePath, sourcePath)
self.mainWindow.appendStatus(
self, u'<span style="color:#CC3333;">ERROR: Unable to copy new database file.</span>')
self.mainWindow.showStatusDone(self)
return
if os.path.exists(savePath):
SystemUtils.remove(savePath)
self.mainWindow.appendStatus(self, u'<span style="color:#33CC33;">Database Replaced</span>')
self.mainWindow.showStatusDone(self)