本文整理汇总了Python中General.makedirs方法的典型用法代码示例。如果您正苦于以下问题:Python General.makedirs方法的具体用法?Python General.makedirs怎么用?Python General.makedirs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类General
的用法示例。
在下文中一共展示了General.makedirs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_with_computer
# 需要导入模块: import General [as 别名]
# 或者: from General import makedirs [as 别名]
def start_with_computer(enabled):
"""If enabled, create shortcut to start application with computer.
If disabled, then delete the shortcut."""
if not enabled:
if os.path.lexists(autostart_path):
FileUtilities.delete(autostart_path)
return
if os.path.lexists(autostart_path):
return
import shutil
General.makedirs(os.path.dirname(autostart_path))
shutil.copy(launcher_path, autostart_path)
os.chmod(autostart_path, 0755)
if General.sudo_mode():
General.chownself(autostart_path)
示例2: __flush
# 需要导入模块: import General [as 别名]
# 或者: from General import makedirs [as 别名]
def __flush(self):
"""Write information to disk"""
if not self.purged:
self.__purge()
if not os.path.exists(Common.options_dir):
General.makedirs(Common.options_dir)
mkfile = not os.path.exists(Common.options_file)
_file = open(Common.options_file, 'wb')
try:
self.config.write(_file)
except IOError, e:
print e
from errno import ENOSPC
if e.errno == ENOSPC:
print "Error: disk is full writing configuration '%s'" % Common.options_file
else:
raise
示例3: start_with_computer
# 需要导入模块: import General [as 别名]
# 或者: from General import makedirs [as 别名]
def start_with_computer(enabled):
"""If enabled, create shortcut to start application with computer.
If disabled, then delete the shortcut."""
if not enabled:
# User requests to not automatically start BleachBit
if os.path.lexists(autostart_path):
# Delete the shortcut
FileUtilities.delete(autostart_path)
return
# User requests to automatically start BleachBit
if os.path.lexists(autostart_path):
# Already automatic, so exit
return
if not os.path.exists(Common.launcher_path):
print 'ERROR: does not exist: ', Common.launcher_path
return
import shutil
General.makedirs(os.path.dirname(autostart_path))
shutil.copy(Common.launcher_path, autostart_path)
os.chmod(autostart_path, 0755)
if General.sudo_mode():
General.chownself(autostart_path)