Re: [Vala] Vala on Windows



Jürg Billeter wrote:
On Mon, 2008-02-04 at 23:04 +0200, Vlad Grecescu wrote:
  
The installation folders above are determined by looking up the
folder where the module (DLL or EXE) in question is located. If the
folder's name is "bin", its parent is used, otherwise the folder
itself.

I think is _exactly_ what's intended.
    

Yes, that's how it should work. I've fixed this in r1083 and another
Windows issue in r1082. Testing welcome.

Jürg
  
I tested and it does have a small issue, which I suppose it's a compiler issue - maybe you can have a look:

        if (vapi_directories != null) {
            foreach (string vapidir in vapi_directories) {
                var filename = Path.build_filename (vapidir, basename);
                if (FileUtils.test (filename, FileTest.EXISTS)) {
                    return filename;
                }
            }
        }

        string filename = Path.build_filename (Config.PACKAGE_DATADIR, "vapi", basename);
        if (FileUtils.test (filename, FileTest.EXISTS)) {
            return filename;
        }

        foreach (string vapidir in Environment.get_system_data_dirs ()) {
            var filename = Path.build_filename (vapidir, "vala/vapi", basename);
            if (FileUtils.test (filename, FileTest.EXISTS)) {
                return filename;
            }
        }

The first return statement generates
return (_tmp0 = filename, (vapidir = (g_free (vapidir), NULL)), (basename = (g_free (basename), NULL)), _tmp0);

while the third generates
return (_tmp3 = filename, (vapidir = (g_free (vapidir), NULL)), (basename = (g_free (basename), NULL)), (filename = (g_free (filename), NULL)), _tmp3);

The difference seems to be that meanwhile a broader-scoped filename identifier appeared.

I worked around the issue (patch attached) but I suppose a bug should be filed for the compiler - I just don't know what would be the desired behavior (issue an error or compile gracefully)?

Thanks,
-- 
Vlad http://blad.wordpress.com
Index: vala/valacodecontext.vala
===================================================================
--- vala/valacodecontext.vala   (revision 1097)
+++ vala/valacodecontext.vala   (working copy)
@@ -387,23 +387,24 @@
 
        public string get_package_path (string! pkg, [CCode (array_length_pos = 1.9)] string[] 
vapi_directories) {
                string basename = "%s.vapi".printf (pkg);
-
+               string filename;
+               
                if (vapi_directories != null) {
                        foreach (string vapidir in vapi_directories) {
-                               var filename = Path.build_filename (vapidir, basename);
+                               filename = Path.build_filename (vapidir, basename);
                                if (FileUtils.test (filename, FileTest.EXISTS)) {
                                        return filename;
                                }
                        }
                }
 
-               string filename = Path.build_filename (Config.PACKAGE_DATADIR, "vapi", basename);
+               filename = Path.build_filename (Config.PACKAGE_DATADIR, "vapi", basename);
                if (FileUtils.test (filename, FileTest.EXISTS)) {
                        return filename;
                }
 
                foreach (string vapidir in Environment.get_system_data_dirs ()) {
-                       var filename = Path.build_filename (vapidir, "vala/vapi", basename);
+                       filename = Path.build_filename (vapidir, "vala/vapi", basename);
                        if (FileUtils.test (filename, FileTest.EXISTS)) {
                                return filename;
                        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]