+ special case: allow single parent directory when saving relative source file paths
This commit is contained in:
parent
13b364bcc1
commit
0580b4ea9d
@ -24,7 +24,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: GUI.java,v 1.118 2009/03/13 15:15:37 fros4943 Exp $
|
||||
* $Id: GUI.java,v 1.119 2009/03/17 09:16:36 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja;
|
||||
@ -3812,10 +3812,16 @@ public class GUI extends Observable {
|
||||
String configCanonical = configPath.getCanonicalPath();
|
||||
|
||||
String fileCanonical = file.getCanonicalPath();
|
||||
if (!fileCanonical.startsWith(configCanonical)) {
|
||||
|
||||
/* SPECIAL CASE: Allow one parent directory */
|
||||
configCanonical = configPath.getParentFile().getCanonicalPath();
|
||||
configIdentifier += "/..";
|
||||
if (!fileCanonical.startsWith(configCanonical)) {
|
||||
/*logger.warn("Error when converting to config relative path: file not in config directory: " + file.getAbsolutePath());*/
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
/* Replace config's canonical path with config identifier */
|
||||
String newFilePath = fileCanonical.replace(configCanonical, configIdentifier);
|
||||
|
Loading…
Reference in New Issue
Block a user