diff options
author | Juerg Billeter <j@bitron.ch> | 2008-02-03 21:47:02 +0000 |
---|---|---|
committer | Jürg Billeter <juergbi@src.gnome.org> | 2008-02-03 21:47:02 +0000 |
commit | e4ba0f8a011ab81031ff1c402217b1ab358b532c (patch) | |
tree | 873b5de2291990b91afc36a12cf49fc248e4c5bc /vapigen/valavapigen.vala | |
parent | c77e1e10f0a4ad21bce04c89e962a5c5b367c78d (diff) | |
download | vala-e4ba0f8a011ab81031ff1c402217b1ab358b532c.tar.gz |
move get_package_path method to libvala
2008-02-03 Juerg Billeter <j@bitron.ch>
* vala/Makefile.am, vala/valacodecontext.vala,
compiler/valacompiler.vala, vapigen/valavapigen.vala: move
get_package_path method to libvala
svn path=/trunk/; revision=959
Diffstat (limited to 'vapigen/valavapigen.vala')
-rw-r--r-- | vapigen/valavapigen.vala | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/vapigen/valavapigen.vala b/vapigen/valavapigen.vala index 0ada9e77c..f2c34c183 100644 --- a/vapigen/valavapigen.vala +++ b/vapigen/valavapigen.vala @@ -59,44 +59,21 @@ class Vala.VAPIGen : Object { return 1; } } - - private string get_package_path (string! pkg) { - var basename = "%s.vapi".printf (pkg); - - if (vapi_directories != null) { - foreach (string vapidir in vapi_directories) { - var filename = Path.build_filename (vapidir, basename, null); - if (FileUtils.test (filename, FileTest.EXISTS)) { - return filename; - } - } - } - - var filename = Path.build_filename ("/usr/local/share/vala/vapi", basename, null); - if (FileUtils.test (filename, FileTest.EXISTS)) { - return filename; - } - - filename = Path.build_filename ("/usr/share/vala/vapi", basename, null); - if (FileUtils.test (filename, FileTest.EXISTS)) { - return filename; - } - - return null; - } - + private bool add_package (string! pkg) { if (context.has_package (pkg)) { // ignore multiple occurences of the same package return true; } - var package_path = get_package_path (pkg); + var package_path = context.get_package_path (pkg, vapi_directories); if (package_path == null) { return false; } + context.add_package (pkg); + context.add_source_file (new SourceFile (context, package_path, true)); return true; |