@@ -1480,8 +1480,18 @@ public static void Up_Click(object sender, RoutedEventArgs e)
1480
1480
{
1481
1481
var instance = ( instanceContentFrame . Content as GenericFileBrowser ) . instanceViewModel ;
1482
1482
instance . CancelLoadAndClearFiles ( ) ;
1483
- var parentDirectoryOfPath = instance . Universal . path . Remove ( instance . Universal . path . LastIndexOf ( "\\ " ) ) ;
1484
-
1483
+ string parentDirectoryOfPath = null ;
1484
+ // Check that there isn't a slash at the end
1485
+ if ( ( instance . Universal . path . Count ( ) - 1 ) - instance . Universal . path . LastIndexOf ( "\\ " ) > 0 )
1486
+ {
1487
+ parentDirectoryOfPath = instance . Universal . path . Remove ( instance . Universal . path . LastIndexOf ( "\\ " ) ) ;
1488
+ }
1489
+ else // Slash found at end
1490
+ {
1491
+ var currentPathWithoutEndingSlash = instance . Universal . path . Remove ( instance . Universal . path . LastIndexOf ( "\\ " ) ) ;
1492
+ parentDirectoryOfPath = currentPathWithoutEndingSlash . Remove ( currentPathWithoutEndingSlash . LastIndexOf ( "\\ " ) ) ;
1493
+ }
1494
+
1485
1495
var CurrentTabInstance = ItemViewModel < ProHome > . GetCurrentSelectedTabInstance < ProHome > ( ) ;
1486
1496
if ( parentDirectoryOfPath == ProHome . DesktopPath )
1487
1497
{
@@ -1547,7 +1557,17 @@ public static void Up_Click(object sender, RoutedEventArgs e)
1547
1557
{
1548
1558
var instance = ( instanceContentFrame . Content as PhotoAlbum ) . instanceViewModel ;
1549
1559
instance . CancelLoadAndClearFiles ( ) ;
1550
- var parentDirectoryOfPath = instance . Universal . path . Remove ( instance . Universal . path . LastIndexOf ( "\\ " ) ) ;
1560
+ string parentDirectoryOfPath = null ;
1561
+ // Check that there isn't a slash at the end
1562
+ if ( ( instance . Universal . path . Count ( ) - 1 ) - instance . Universal . path . LastIndexOf ( "\\ " ) > 0 )
1563
+ {
1564
+ parentDirectoryOfPath = instance . Universal . path . Remove ( instance . Universal . path . LastIndexOf ( "\\ " ) ) ;
1565
+ }
1566
+ else // Slash found at end
1567
+ {
1568
+ var currentPathWithoutEndingSlash = instance . Universal . path . Remove ( instance . Universal . path . LastIndexOf ( "\\ " ) ) ;
1569
+ parentDirectoryOfPath = currentPathWithoutEndingSlash . Remove ( currentPathWithoutEndingSlash . LastIndexOf ( "\\ " ) ) ;
1570
+ }
1551
1571
1552
1572
var CurrentTabInstance = ItemViewModel < ProHome > . GetCurrentSelectedTabInstance < ProHome > ( ) ;
1553
1573
if ( parentDirectoryOfPath == ProHome . DesktopPath )
0 commit comments