;ò M/Ec@s>dZdkZdklZd„Zd„Zdd„ZdS(sÜUtilities to perform various operations on paths, with support for opening the ROX filer to examine locations if things go wrong. Typical usage: import rox.fileutils rox.fileutils.makedirs('/path/for/new/directory') N(s_c Cs—dkl}l}l}l} l}|ƒ|itd|i|i |ƒ}||i t dƒƒ}|i|iƒ|iƒ|i||iƒ||it dƒƒ}|i|iƒ|iƒ|i||iƒ|i|iƒ|it dƒƒ|i|iƒxRnoJ|iƒ} | t|iƒjoPntii|ƒ}|i!|ƒqW|i"ƒ| ƒ| t|iƒjo t#|‚ndS(s©Display a // dialog. This will raise an OSError exception if the user selects Cancel, or will return successfully if the user chooses to retry.(sgsfilers toplevel_refstoplevel_unrefs ButtonMixedisRetrysExaminesError:iN($sroxsgsfilers toplevel_refstoplevel_unrefs ButtonMixeds MessageDialogsNonesMESSAGE_QUESTIONsBUTTONS_CANCELsmessagesboxs STOCK_REDOs_sbuttons set_flagss CAN_DEFAULTsshowsadd_action_widgets RESPONSE_OKs STOCK_JUMP_TOsRESPONSE_APPLYs set_positionsWIN_POS_CENTERs set_titlesset_default_responsesrunsrespsintsosspathsnormpaths filerpaths show_filesdestroysOSError( smessagespathsboxsfilers ButtonMixedsgs toplevel_refsbuttons filerpathstoplevel_unrefsresp((sW/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/fileutils.pysreport_patherror s6%    cCstii|ƒodSntii|ƒ\}}| otii|ƒ\}}n|o|ot||ƒnx’toŠtii |ƒot t dƒ||ƒqynyti ||ƒdSWqyt j o.}t dt dƒ|d|f|ƒqyXqyWdS(s¬Recursive part of makedirs. Calls itself to ensure head of path exists, and then makes a new directory at path. Returns an Exception if it can't make a directory at path.NsLCould not create directory `%s' because a file already exists at that path. s%s. s!Could not create directory `%s'. i(sosspathsisdirssplitsheadstails_makedirs_recursivesmodesTruesexistssreport_patherrors_smkdirsOSErrorsmsg(spathsmodesheadstailsmsg((sW/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/fileutils.pys_makedirs_recursive-s&iÿcCs#tii|ƒ}t||ƒdS(sáMake a directory at the specified path, creating intermediate directories if necessary. No error if 'path' is already a directory. On error, a dialog which allows the user to open the filer to fix things and then retry will be opened. Returns successfully if all directories get created (or already exist), Raises an OSError if there is a problem, in which case the application should not open a dialog box to inform the user, since one will already have been displayed. N(sosspathsnormpaths_makedirs_recursivesmode(spathsmode((sW/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/fileutils.pysmakedirsDs (s__doc__sossroxs_sreport_patherrors_makedirs_recursivesmakedirs(sreport_patherrorsossmakedirss_s_makedirs_recursive((sW/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/fileutils.pys?s