1
1
import python
2
2
3
3
/** A file */
4
- class File extends Container {
5
- File ( ) { files ( this , _, _, _, _) }
6
-
4
+ class File extends Container , @file {
7
5
/** DEPRECATED: Use `getAbsolutePath` instead. */
8
6
deprecated override string getName ( ) { result = this .getAbsolutePath ( ) }
9
7
@@ -34,9 +32,7 @@ class File extends Container {
34
32
}
35
33
36
34
/** Gets a short name for this file (just the file name) */
37
- string getShortName ( ) {
38
- exists ( string simple , string ext | files ( this , _, simple , ext , _) | result = simple + ext )
39
- }
35
+ string getShortName ( ) { result = this .getBaseName ( ) }
40
36
41
37
private int lastLine ( ) {
42
38
result = max ( int i | exists ( Location l | l .getFile ( ) = this and l .getEndLine ( ) = i ) )
@@ -55,7 +51,7 @@ class File extends Container {
55
51
)
56
52
}
57
53
58
- override string getAbsolutePath ( ) { files ( this , result , _ , _ , _ ) }
54
+ override string getAbsolutePath ( ) { files ( this , result ) }
59
55
60
56
/** Gets the URL of this file. */
61
57
override string getURL ( ) { result = "file://" + this .getAbsolutePath ( ) + ":0:0:0:0" }
@@ -118,15 +114,10 @@ private predicate occupied_line(File f, int n) {
118
114
}
119
115
120
116
/** A folder (directory) */
121
- class Folder extends Container {
122
- Folder ( ) { folders ( this , _, _) }
123
-
117
+ class Folder extends Container , @folder {
124
118
/** DEPRECATED: Use `getAbsolutePath` instead. */
125
119
deprecated override string getName ( ) { result = this .getAbsolutePath ( ) }
126
120
127
- /** DEPRECATED: Use `getBaseName` instead. */
128
- deprecated string getSimple ( ) { folders ( this , _, result ) }
129
-
130
121
/**
131
122
* Holds if this element is at the specified location.
132
123
* The location spans column `startcolumn` of line `startline` to
@@ -144,7 +135,7 @@ class Folder extends Container {
144
135
endcolumn = 0
145
136
}
146
137
147
- override string getAbsolutePath ( ) { folders ( this , result , _ ) }
138
+ override string getAbsolutePath ( ) { folders ( this , result ) }
148
139
149
140
/** Gets the URL of this folder. */
150
141
override string getURL ( ) { result = "folder://" + this .getAbsolutePath ( ) }
0 commit comments