From the Xpert.ivy help I succeeded in converting a ivy File Object to an Java File Object by using...

java.io.File tempFile = in.someIvyFileObjectInstance.getJavaFile();

But what about the inverse way: Java File -> Ivy File? I didn't found a solution for this.

asked 12.12.2013 at 16:56

Bj%C3%B6rn's gravatar image

Björn
(suspended)
accept rate: 100%


The ivy file is always relative addressed (relative to the files folder of the application). See more details on the Designer Help about ivyScript File. So normally it makes no sense to generate an ivy file out of a java file if you do not want it to be saved/acessed relatively.

Possible solution to move a java file into a ivy file: 1. Create IvyFile, then move the java File to the new ivy file.

import org.apache.commons.io.FileUtils;

java.io.File javaFile = new java.io.File("/tmp/myFile.txt");
File ivyFile = new File("myFolder/" + javaFile.getName());
FileUtils.moveFile(javaFile, ivyFile.getJavaFile());
link

answered 13.12.2013 at 14:14

Christian%20Strebel's gravatar image

Christian St... ♦
3.2k31338
accept rate: 88%

Hi Christian. Thanks for your answer. This was exactly, what I was looking for. I only changed moveFile to copyFile for my needs.

(13.12.2013 at 17:57) Björn Bj%C3%B6rn's gravatar image

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×52
×18

Asked: 12.12.2013 at 16:56

Seen: 4,739 times

Last updated: 13.12.2013 at 17:57