01: /*
02: * TransferDirectory.java
03: *
04: * Created on July 9, 2002, 11:15 AM
05: */
06:
07: package com.sun.portal.ffj.util;
08:
09: import java.io.File;
10:
11: /**
12: *
13: * @author yabob
14: */
15: public class TransferDesktopFile extends Transfer {
16:
17: public TransferDesktopFile(String target, String fromdir, String fn) {
18:
19: if (target.startsWith("classes")) {
20: m_ToClassDir = true;
21: } else {
22: m_ToClassDir = false;
23: }
24:
25: m_Target = new File(target, fn);
26: m_FromDir = fromdir == null ? null : new File(fromdir);
27: m_FName = fn;
28: }
29:
30: public void transfer(File wsroot, String wsdir, File psfs) {
31: File sourcedir = null;
32: if (m_FromDir == null) {
33: sourcedir = wsdir == null ? wsroot
34: : new File(wsroot, wsdir);
35: } else {
36: if (m_FromDir.isAbsolute()) {
37: sourcedir = m_FromDir;
38: } else {
39: sourcedir = new File(wsroot, m_FromDir.getPath());
40: }
41: }
42:
43: File troot = m_ToClassDir ? new File(psfs, "WEB-INF")
44: : new File(psfs, "desktop");
45: copy(new File(sourcedir, m_FName), new File(troot, m_Target
46: .getPath()));
47: }
48:
49: private File m_Target;
50: private File m_FromDir;
51: private String m_FName;
52: private boolean m_ToClassDir;
53: }
|