|
@@ -18,6 +18,8 @@ CardReader::CardReader()
|
18
|
18
|
saving = false;
|
19
|
19
|
logging = false;
|
20
|
20
|
autostart_atmillis=0;
|
|
21
|
+ workDirDepth = 0;
|
|
22
|
+ memset(workDirParents, 0, sizeof(workDirParents));
|
21
|
23
|
|
22
|
24
|
autostart_stilltocheck=true; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
|
23
|
25
|
lastnr=0;
|
|
@@ -521,19 +523,24 @@ void CardReader::chdir(const char * relpath)
|
521
|
523
|
}
|
522
|
524
|
else
|
523
|
525
|
{
|
524
|
|
- workDirParentParent=workDirParent;
|
525
|
|
- workDirParent=*parent;
|
526
|
|
-
|
|
526
|
+ if (workDirDepth < MAX_DIR_DEPTH) {
|
|
527
|
+ for (int d = ++workDirDepth; d--;)
|
|
528
|
+ workDirParents[d+1] = workDirParents[d];
|
|
529
|
+ workDirParents[0]=*parent;
|
|
530
|
+ }
|
527
|
531
|
workDir=newfile;
|
528
|
532
|
}
|
529
|
533
|
}
|
530
|
534
|
|
531
|
535
|
void CardReader::updir()
|
532
|
536
|
{
|
533
|
|
- if(!workDir.isRoot())
|
|
537
|
+ if(workDirDepth > 0)
|
534
|
538
|
{
|
535
|
|
- workDir=workDirParent;
|
536
|
|
- workDirParent=workDirParentParent;
|
|
539
|
+ --workDirDepth;
|
|
540
|
+ workDir = workDirParents[0];
|
|
541
|
+ int d;
|
|
542
|
+ for (int d = 0; d < workDirDepth; d++)
|
|
543
|
+ workDirParents[d] = workDirParents[d+1];
|
537
|
544
|
}
|
538
|
545
|
}
|
539
|
546
|
|