diff options
author | Johan Dahlin <johan@gnome.org> | 2010-09-01 20:53:32 -0300 |
---|---|---|
committer | Johan Dahlin <johan@gnome.org> | 2010-09-01 20:55:13 -0300 |
commit | 2399da3d6030818b3bf9882bd37bbadacc72834d (patch) | |
tree | 75ce0c88f3bcaad078e1372e2d07ee9e2b1e26d7 /giscanner/scannermain.py | |
parent | ef09647a7e634d91ff6f7f0fd046a8964c26598c (diff) | |
download | gobject-introspection-2399da3d6030818b3bf9882bd37bbadacc72834d.tar.gz |
[scannermain] Write to tempdir if needed
If the current directory is not writable nor if
the directory of the output file isn't, use the standard
temporayr directory as a last resort.
Diffstat (limited to 'giscanner/scannermain.py')
-rw-r--r-- | giscanner/scannermain.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py index 587c661a..2d3ced4b 100644 --- a/giscanner/scannermain.py +++ b/giscanner/scannermain.py @@ -358,6 +358,8 @@ def scanner_main(args): data = writer.get_xml() if options.output and options.output != "-": tempdir = os.path.dirname(options.output) or os.getcwd() + if not os.access(tempdir, os.W_OK): + tempdir = tempfile.gettempdir() main_f = tempfile.NamedTemporaryFile(suffix='.gir', dir=tempdir, delete=False) main_f.write(data) main_f.close() |