]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*\r |
2 | * \r | |
3 | * Copyright 2002-2004 The Ant-Contrib project\r | |
4 | *\r | |
5 | * Licensed under the Apache License, Version 2.0 (the "License");\r | |
6 | * you may not use this file except in compliance with the License.\r | |
7 | * You may obtain a copy of the License at\r | |
8 | *\r | |
9 | * http://www.apache.org/licenses/LICENSE-2.0\r | |
10 | *\r | |
11 | * Unless required by applicable law or agreed to in writing, software\r | |
12 | * distributed under the License is distributed on an "AS IS" BASIS,\r | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r | |
14 | * See the License for the specific language governing permissions and\r | |
15 | * limitations under the License.\r | |
16 | */\r | |
17 | package net.sf.antcontrib.cpptasks;\r | |
18 | import java.io.File;\r | |
19 | import java.io.IOException;\r | |
20 | /**\r | |
21 | * The history of a source file used to build a target\r | |
22 | * \r | |
23 | * @author Curt Arnold\r | |
24 | */\r | |
25 | public final class SourceHistory {\r | |
26 | private/* final */long lastModified;\r | |
27 | private/* final */String relativePath;\r | |
28 | /**\r | |
29 | * Constructor\r | |
30 | */\r | |
31 | public SourceHistory(String relativePath, long lastModified) {\r | |
32 | if (relativePath == null) {\r | |
33 | throw new NullPointerException("relativePath");\r | |
34 | }\r | |
35 | this.relativePath = relativePath;\r | |
36 | this.lastModified = lastModified;\r | |
37 | }\r | |
38 | public String getAbsolutePath(File baseDir) {\r | |
39 | try {\r | |
40 | return new File(baseDir, relativePath).getCanonicalPath();\r | |
41 | } catch (IOException ex) {\r | |
42 | }\r | |
43 | return relativePath;\r | |
44 | }\r | |
45 | public long getLastModified() {\r | |
46 | return lastModified;\r | |
47 | }\r | |
48 | public String getRelativePath() {\r | |
49 | return relativePath;\r | |
50 | }\r | |
51 | }\r |