Allow more dir levels

This commit is contained in:
TheFloW 2018-09-13 15:12:28 +02:00
parent 92b1ec481e
commit a4829945cc
5 changed files with 18 additions and 9 deletions

View File

@ -17,6 +17,7 @@
*/ */
#include "main.h" #include "main.h"
#include "browser.h"
#include "archive.h" #include "archive.h"
#include "psarc.h" #include "psarc.h"
#include "file.h" #include "file.h"

View File

@ -108,11 +108,14 @@ static void storeSymlinkPath(SymlinkDirectoryPath * path) {
} }
void dirLevelUp() { void dirLevelUp() {
base_pos_list[dir_level] = base_pos; if (dir_level < MAX_DIR_LEVELS - 1) {
rel_pos_list[dir_level] = rel_pos; base_pos_list[dir_level] = base_pos;
dir_level++; rel_pos_list[dir_level] = rel_pos;
base_pos_list[dir_level] = 0; dir_level++;
rel_pos_list[dir_level] = 0; base_pos_list[dir_level] = 0;
rel_pos_list[dir_level] = 0;
}
base_pos = 0; base_pos = 0;
rel_pos = 0; rel_pos = 0;
} }
@ -234,6 +237,9 @@ static void dirUp() {
dir_level = 0; dir_level = 0;
DIR_UP_RETURN: DIR_UP_RETURN:
if (dir_level < 0)
dir_level = 0;
base_pos = (int)base_pos_list[dir_level]; base_pos = (int)base_pos_list[dir_level];
rel_pos = (int)rel_pos_list[dir_level]; rel_pos = (int)rel_pos_list[dir_level];
dirUpCloseArchive(); dirUpCloseArchive();

View File

@ -19,6 +19,11 @@
#ifndef __BROWSER_H__ #ifndef __BROWSER_H__
#define __BROWSER_H__ #define __BROWSER_H__
#define MAX_DIR_LEVELS 128
#define HOME_PATH "home"
#define DIR_UP ".."
extern FileList file_list, mark_list, copy_list, install_list; extern FileList file_list, mark_list, copy_list, install_list;
extern char cur_file[MAX_PATH_LENGTH]; extern char cur_file[MAX_PATH_LENGTH];

4
file.h
View File

@ -26,14 +26,10 @@
#define MAX_NAME_LENGTH 256 #define MAX_NAME_LENGTH 256
#define MAX_SHORT_NAME_LENGTH 64 #define MAX_SHORT_NAME_LENGTH 64
#define MAX_MOUNT_POINT_LENGTH 16 #define MAX_MOUNT_POINT_LENGTH 16
#define MAX_DIR_LEVELS 32
#define DIRECTORY_SIZE (4 * 1024) #define DIRECTORY_SIZE (4 * 1024)
#define TRANSFER_SIZE (128 * 1024) #define TRANSFER_SIZE (128 * 1024)
#define HOME_PATH "home"
#define DIR_UP ".."
#define SYMLINK_HEADER_SIZE 4 #define SYMLINK_HEADER_SIZE 4
#define SYMLINK_MAX_SIZE (SYMLINK_HEADER_SIZE + MAX_PATH_LENGTH) #define SYMLINK_MAX_SIZE (SYMLINK_HEADER_SIZE + MAX_PATH_LENGTH)
#define SYMLINK_EXT "lnk" #define SYMLINK_EXT "lnk"

View File

@ -17,6 +17,7 @@
*/ */
#include "main.h" #include "main.h"
#include "browser.h"
#include "psarc.h" #include "psarc.h"
#include "file.h" #include "file.h"
#include "utils.h" #include "utils.h"