We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Base File (Read 991 times)
Base File
Feb 18th, 2010, 2:31am
 
Hello,

I wrote those few lines in order to copy files, delete old one and remove a folder.



import processing.app.Base;
 Base base;

void setup()
{
 
 File origPdeFile  = new File("My_original_file");
       File  properPdeFile= new File("My_new file");
       try {
         Base.copyFile(origPdeFile, properPdeFile);
       } catch (IOException e) {
         Base.showWarning("Error", "Could not copy to a proper location.", e);
       }
       
       origPdeFile.delete();  // remove the original file, so user doesn't get confused            
       
       File dir=new File(sketchPath("tst"));
       Base.removeDir(dir);        
}






This works perfectly when i run it into processing...
but doesn't as soon as i export application !!!

There is probably a very good reason and a way to make it works but i don't find it.

Maybe someone coul'd help me !
Re: Base File
Reply #1 - Feb 18th, 2010, 2:36am
 
Sorry i post it twice but when i type "post" it return an error so i do it again whithout smileys ...
Re: Base File
Reply #2 - Feb 18th, 2010, 4:52am
 
I have deleted the other post. You can use the [ code ] [ /code ] (without spaces) tags to embed your code.


I think your problem may be related to absolute / relative path, don't you think?
Re: Base File
Reply #3 - Feb 19th, 2010, 7:05am
 
No i check the path is good,

Code:

import processing.app.Base;
Base base;
PFont font;

void setup()
{
size(400,200);
font=loadFont("Aharoni-Bold-14.vlw");
textFont(font);

File dir=new File(sketchPath("tst"));
text(sketchPath("tst"),0,0,400,200);
println(dir);
Base.removeDir(dir);
}


in processing the Path is writen and all is right
but in exported application nothing is writen by "text" the frame is not visible
i think the program bug but i don't know where !
Re: Base File
Reply #4 - Feb 23rd, 2010, 5:11am
 
Nobody to help me ?
Re: Base File
Reply #5 - Feb 23rd, 2010, 6:58am
 
You use processing.app.Base which is a class of PDE itself.
When exporting an application, pde.jar isn't included, as it isn't necessary to run exported applications.
I suggest to find better ways to do your operations as adding a 376KB jar file to your app to do such base operations is a bit of overkill...
A way is to take Base.java code and copy the methods you use into your sketch...
Re: Base File
Reply #6 - Feb 26th, 2010, 3:34am
 
Thanks Philoh

I found what i was looking for in the link you gave !
Page Index Toggle Pages: 1