Revision 1084 org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl/src/main/java/org/gvsig/scripting/impl/DefaultScriptingFolder.java
DefaultScriptingFolder.java | ||
---|---|---|
118 | 118 |
} |
119 | 119 |
|
120 | 120 |
} |
121 |
|
|
122 |
public Unit getUnit(String path) { |
|
123 |
path = FilenameUtils.normalizeNoEndSeparator(path, true); |
|
124 |
if( path == null ) { |
|
125 |
return null; |
|
126 |
} |
|
127 |
File f; |
|
128 |
ScriptingUnit unit; |
|
129 |
String[] path_a = StringUtils.split(path, '/'); |
|
130 |
switch( path_a.length ) { |
|
131 |
case 0: |
|
132 |
return null; |
|
133 |
default: |
|
134 |
f = new File(this.getFile(), path_a[0]); |
|
135 |
unit = this.getUnit(f); |
|
136 |
if( unit instanceof ScriptingFolder ) { |
|
137 |
unit = ((ScriptingFolder) unit).getUnit( |
|
138 |
StringUtils.join(path_a, '/', 1, path_a.length) |
|
139 |
); |
|
140 |
return (Unit) unit; |
|
141 |
} |
|
142 |
return null; |
|
143 |
case 1: |
|
144 |
f = new File(this.getFile(), path_a[0]); |
|
145 |
unit = this.getUnit(f); |
|
146 |
return (Unit) unit; |
|
147 |
} |
|
148 |
|
|
149 |
} |
|
150 |
|
|
121 | 151 |
|
122 | 152 |
@Override |
123 | 153 |
public Unit getUnit(File afile) { |
Also available in: Unified diff