@@ -164,6 +164,18 @@ module.exports = class FSNodeContext {
164
164
if ( this . found === false ) return undefined ;
165
165
return ! this . entry . parent_uid ;
166
166
}
167
+
168
+ async isAppDataDirectory ( ) {
169
+ if ( this . isRoot ) return false ;
170
+ if ( this . found === undefined ) {
171
+ await this . fetchEntry ( ) ;
172
+ }
173
+ if ( this . isRoot ) return false ;
174
+
175
+ const components = await this . getPathComponents ( ) ;
176
+ if ( components . length < 2 ) return false ;
177
+ return components [ 1 ] === 'AppData' ;
178
+ }
167
179
168
180
async isPublic ( ) {
169
181
if ( this . isRoot ) return false ;
@@ -175,7 +187,19 @@ module.exports = class FSNodeContext {
175
187
176
188
async getPathComponents ( ) {
177
189
if ( this . isRoot ) return [ ] ;
178
-
190
+
191
+ // We can get path components for non-existing nodes if they
192
+ // have a path selector
193
+ if ( ! await this . exists ( ) ) {
194
+ if ( this . selector instanceof NodePathSelector ) {
195
+ let path = this . selector . value ;
196
+ if ( path . startsWith ( '/' ) ) path = path . slice ( 1 ) ;
197
+ return path . split ( '/' ) ;
198
+ }
199
+
200
+ // TODO: add support for NodeChildSelector as well
201
+ }
202
+
179
203
let path = await this . get ( 'path' ) ;
180
204
if ( path . startsWith ( '/' ) ) path = path . slice ( 1 ) ;
181
205
return path . split ( '/' ) ;
0 commit comments