← Back
Editing: file_util.cpython-38.pyc
U K��^@ � @ s* d dl Z d dlZd dlZdZddd�ZdS )� Ni� �wbFc C s� |dkrt }|r@zt�| �}t�|j�}W n tk r> Y nX d}zJtjtj� | �d|d�}|� |� |�� t�|j |� t�|j | � W n: tk r� } z|dk r�t�|j � |�W 5 d}~X Y nX dS )zbAtomically write filename. open filename in mode 'omode', write content, chmod to 'mode'. NF)�dir�delete�mode)� _DEF_PERMS�os�stat�S_IMODE�st_mode�OSError�tempfileZNamedTemporaryFile�path�dirname�write�close�chmod�name�rename�unlink)�filenameZcontentr ZomodeZ copy_modeZ file_statZtf�e� r �//usr/share/subiquity/subiquitycore/file_util.py� write_file s, � r )Nr F)r r r r r r r r r �<module> s
Save File
Cancel