added argument for disallowing config relative paths

This commit is contained in:
fros4943 2010-06-11 09:10:52 +00:00
parent 419906a769
commit b540408add

View file

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: GUI.java,v 1.169 2010/05/19 17:32:54 fros4943 Exp $ * $Id: GUI.java,v 1.170 2010/06/11 09:10:52 fros4943 Exp $
*/ */
package se.sics.cooja; package se.sics.cooja;
@ -3978,6 +3978,10 @@ public class GUI extends Observable {
* @return Portable file, or original file is conversion failed * @return Portable file, or original file is conversion failed
*/ */
public File createPortablePath(File file) { public File createPortablePath(File file) {
return createPortablePath(file, true);
}
public File createPortablePath(File file, boolean allowConfigRelativePaths) {
File portable = null; File portable = null;
portable = createContikiRelativePath(file); portable = createContikiRelativePath(file);
@ -3986,11 +3990,13 @@ public class GUI extends Observable {
return portable; return portable;
} }
if (allowConfigRelativePaths) {
portable = createConfigRelativePath(file); portable = createConfigRelativePath(file);
if (portable != null) { if (portable != null) {
/*logger.info("Generated config relative path '" + file.getPath() + "' to '" + portable.getPath() + "'");*/ /*logger.info("Generated config relative path '" + file.getPath() + "' to '" + portable.getPath() + "'");*/
return portable; return portable;
} }
}
logger.warn("Path is not portable: '" + file.getPath()); logger.warn("Path is not portable: '" + file.getPath());
return file; return file;