- Timestamp:
- 06/02/04 18:12:13 (21 years ago)
- File:
-
- 1 edited
-
ps/trunk/source/lib/res/vfs.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/source/lib/res/vfs.cpp
r354 r358 351 351 Dir* cur_dir = &vfs_root; 352 352 const char* cur_component = buf; 353 bool is_last_component = false;354 353 355 354 // subdirectory traverse logic … … 374 373 if(slash) 375 374 *slash = 0; 376 // allow root dir ("") and trailing '/' if looking up a dir 375 376 // early outs: 377 // .. last component and it's a filename 378 if(slash == 0 && loc != 0) 379 break; 380 // .. root dir ("") or trailing '/' in dir name 377 381 if(*cur_component == '\0' && loc == 0) 378 382 break; 379 is_last_component = (slash == 0);380 383 381 384 // create <cur_component> subdir (no-op if it already exists) … … 384 387 385 388 // switch to <cur_component> 386 Dir* subdir = cur_dir->find_subdir(cur_component); 387 if(!subdir) 388 { 389 // this last component is a filename. 390 if(is_last_component && loc != 0) 391 break; 392 // otherwise, we had an (invalid) subdir name - fail. 389 cur_dir = cur_dir->find_subdir(cur_component); 390 if(!cur_dir) 393 391 return -ENOENT; 394 }395 cur_dir = subdir; // don't assign if invalid - need cur_dir below.396 392 397 393 // next component 398 if( is_last_component)394 if(!slash) // done, no more components left 399 395 break; 400 396 cur_component = slash+1;
Note:
See TracChangeset
for help on using the changeset viewer.
