[gobject-introspection] [scannermain] Write to tempdir if needed
- From: Johan Dahlin <johan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] [scannermain] Write to tempdir if needed
- Date: Wed, 1 Sep 2010 23:56:43 +0000 (UTC)
commit 2399da3d6030818b3bf9882bd37bbadacc72834d
Author: Johan Dahlin <johan gnome org>
Date: Wed Sep 1 20:53:32 2010 -0300
[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.
giscanner/scannermain.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index 587c661..2d3ced4 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()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]