diff options
author | Juerg Billeter <j@bitron.ch> | 2007-11-27 21:12:19 +0000 |
---|---|---|
committer | Jürg Billeter <juergbi@src.gnome.org> | 2007-11-27 21:12:19 +0000 |
commit | 5807cec3a147f1fbf50e28e6d7ebf12872fe41c0 (patch) | |
tree | 0de4180afc0a25de8fd7c5ff84ef7c54ff7772b4 /gen-project | |
parent | 0326ae6c631f863c6b743f72618f04e47765b830 (diff) | |
download | vala-5807cec3a147f1fbf50e28e6d7ebf12872fe41c0.tar.gz |
search for INSTALL and COPYING files in more directories, don't fail if
2007-11-27 Juerg Billeter <j@bitron.ch>
* gen-project/valaprojectgenerator.vala: search for INSTALL and COPYING
files in more directories, don't fail if auxiliary files can't be
found, based on patch by Marcelo Lira, fixes bug 499806
svn path=/trunk/; revision=731
Diffstat (limited to 'gen-project')
-rw-r--r-- | gen-project/valaprojectgenerator.vala | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/gen-project/valaprojectgenerator.vala b/gen-project/valaprojectgenerator.vala index 5dc8ba6e6..0636515b6 100644 --- a/gen-project/valaprojectgenerator.vala +++ b/gen-project/valaprojectgenerator.vala @@ -193,16 +193,24 @@ class Vala.ProjectGenerator : Dialog { FileUtils.set_contents (project_path + "/po/ChangeLog", "", -1); string s; - FileUtils.get_contents ("/usr/share/automake/INSTALL", out s); - FileUtils.set_contents (project_path + "/INSTALL", s, -1); + string automake_path = get_automake_path (); + if (automake_path != null) { + string install_filename = automake_path + "/INSTALL"; + if (FileUtils.test (install_filename, FileTest.EXISTS)) { + FileUtils.get_contents (install_filename, out s); + FileUtils.set_contents (project_path + "/INSTALL", s, -1); + } + } string license_filename = null; if (project_license == ProjectLicense.GPL2) { - license_filename = "/usr/share/automake/COPYING"; + if (automake_path != null) { + license_filename = automake_path + "/COPYING"; + } } else if (project_license == ProjectLicense.LGPL2) { license_filename = "/usr/share/libtool/libltdl/COPYING.LIB"; } - if (license_filename != null) { + if (license_filename != null && FileUtils.test (license_filename, FileTest.EXISTS)) { FileUtils.get_contents (license_filename, out s); FileUtils.set_contents (project_path + "/COPYING", s, -1); } @@ -559,6 +567,20 @@ class Vala.ProjectGenerator : Dialog { FileUtils.set_contents (project_path + "/MAINTAINERS", s, -1); } + private string get_automake_path () { + var automake_paths = new string[] { "/usr/share/automake", + "/usr/share/automake-1.10", + "/usr/share/automake-1.9" }; + + foreach (string automake_path in automake_paths) { + if (FileUtils.test (automake_path, FileTest.IS_DIR)) { + return automake_path; + } + } + + return null; + } + static void main (string[] args) { Gtk.init (ref args); |