This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 40892
Collapse All | Expand All

(-)nbbuild/antsrc/org/netbeans/nbbuild/GetModuleName.java (-5 / +16 lines)
Lines 40-51 Link Here
40
        if (root == null)
40
        if (root == null)
41
            throw new BuildException("You must set the root dir", this.getLocation());
41
            throw new BuildException("You must set the root dir", this.getLocation());
42
        try {
42
        try {
43
            String basedir = this.getProject().getBaseDir().getCanonicalPath();
43
            File dir = this.getProject ().getBaseDir ();
44
            String rootdir = root.getCanonicalPath();
44
            String rootdir = root.getCanonicalPath();
45
            log("Basedir: " + basedir + " rootdir: " + rootdir);
45
            StringBuffer modulename = new StringBuffer ();
46
            if (!basedir.startsWith(rootdir)) throw new BuildException( "This module in on different path than the root dir",this.getLocation());
46
            while (dir != null) {
47
            String modulename = basedir.substring(rootdir.length() + 1).replace(File.separatorChar,'/');
47
                if (dir.getCanonicalPath ().equals (rootdir)) {
48
            this.getProject().setProperty( name, modulename);
48
                    break;
49
                }
50
                if (modulename.length () > 0) {
51
                    modulename.insert (0, '/');
52
                }
53
                modulename.insert (0, dir.getName ());
54
                dir = dir.getParentFile ();
55
            }
56
            
57
            //log("Basedir: " + basedir + " rootdir: " + rootdir);
58
            if (dir == null) throw new BuildException( "This module in on different path than the root dir",this.getLocation());
59
            this.getProject().setProperty( name, modulename.toString ());
49
        }
60
        }
50
        catch (IOException ex) {
61
        catch (IOException ex) {
51
            throw new BuildException("Root dir or module's base dir wasn't recognized", ex, this.getLocation());
62
            throw new BuildException("Root dir or module's base dir wasn't recognized", ex, this.getLocation());

Return to bug 40892