ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magesh Umasankar" <umag...@apache.org>
Subject Re: ant 1.5 - translate task problem
Date Mon, 06 May 2002 12:10:06 GMT
Applied.  Thanks!

Isn't the example on the documentation page helpful enough?
If not, then, I will try to includ emore documentation
into it based on what you feel is lacking.

Thanks,
Magesh

***********************************************************
*  Classic: A book which people praise, but do not read.  *
***********************************************************
----- Original Message -----
From: "GOMEZ Henri" <hgomez@slib.fr>
To: "Ant Developers List" <ant-dev@jakarta.apache.org>
Sent: Monday, May 06, 2002 3:29 AM
Subject: ant 1.5 - translate task problem


Hi,

While working on the merge of my translator task and
translate from i18n, I see that source file didn't take
care original srcdir and should use fileUtils.resolveFile :

(didn't have patch tool on my box sorry ;<)

orig :

                    destLastModified = dest.lastModified();
                    srcLastModified = new File(srcFiles[i]).lastModified();
                    //Check to see if dest file has to be recreated
                    if (forceOverwrite
                        || destLastModified < srcLastModified
                        || destLastModified < bundleLastModified[0]
                        || destLastModified < bundleLastModified[1]
                        || destLastModified < bundleLastModified[2]
                        || destLastModified < bundleLastModified[3]
                        || destLastModified < bundleLastModified[4]
                        || destLastModified < bundleLastModified[5]
                        || destLastModified < bundleLastModified[6]) {
                        log("Processing " + srcFiles[j],
                            Project.MSG_DEBUG);
                        FileOutputStream fos = new FileOutputStream(dest);
                        BufferedWriter out
                            = new BufferedWriter(new OutputStreamWriter(fos,
destEncoding));
                        FileInputStream fis = new
FileInputStream(srcFiles[j]);
                        BufferedReader in
                            = new BufferedReader(new InputStreamReader(fis,
srcEncoding));
                        String line;

corrected :

                    destLastModified = dest.lastModified();
                    File src = fileUtils.resolveFile(ds.getBasedir(),
srcFiles[j]);
                    FileInputStream fis = new FileInputStream(src);
                    srcLastModified = src.lastModified();
                    //Check to see if dest file has to be recreated
                    if (forceOverwrite
                        || destLastModified < srcLastModified
                        || destLastModified < bundleLastModified[0]
                        || destLastModified < bundleLastModified[1]
                        || destLastModified < bundleLastModified[2]
                        || destLastModified < bundleLastModified[3]
                        || destLastModified < bundleLastModified[4]
                        || destLastModified < bundleLastModified[5]
                        || destLastModified < bundleLastModified[6]) {
                        log("Processing " + srcFiles[j],
                            Project.MSG_DEBUG);
                        FileOutputStream fos = new FileOutputStream(dest);
                        BufferedWriter out
                            = new BufferedWriter(new OutputStreamWriter(fos,
destEncoding));
                        BufferedReader in
                            = new BufferedReader(new InputStreamReader(fis,
srcEncoding));
                        String line;

I'm still working on merge, since I don't like the solution I use of loading
source file in memory (it could be a problem with large source files), and
the multiple rescan, so I'm refactorying my current code to use Magesh
readline approach

I hope to have something ready in some days, but I'd like to have some
resourcebundles examples to make some tests (Magesh ?)

-
Henri Gomez                 ___[_]____
EMAIL : hgomez@slib.fr        (. .)
PGP KEY : 697ECEDD    ...oOOo..(_)..oOOo...
PGP Fingerprint : 9DF8 1EA8 ED53 2F39 DC9B 904A 364F 80E6


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message