Skip to content

Commit

Permalink
Allow more dir levels
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOfficialFloW committed Sep 13, 2018
1 parent 92b1ec4 commit a482994
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "main.h"
#include "browser.h"
#include "archive.h"
#include "psarc.h"
#include "file.h"
Expand Down
16 changes: 11 additions & 5 deletions browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,14 @@ static void storeSymlinkPath(SymlinkDirectoryPath * path) {
}

void dirLevelUp() {
base_pos_list[dir_level] = base_pos;
rel_pos_list[dir_level] = rel_pos;
dir_level++;
base_pos_list[dir_level] = 0;
rel_pos_list[dir_level] = 0;
if (dir_level < MAX_DIR_LEVELS - 1) {
base_pos_list[dir_level] = base_pos;
rel_pos_list[dir_level] = rel_pos;
dir_level++;
base_pos_list[dir_level] = 0;
rel_pos_list[dir_level] = 0;
}

base_pos = 0;
rel_pos = 0;
}
Expand Down Expand Up @@ -234,6 +237,9 @@ static void dirUp() {
dir_level = 0;

DIR_UP_RETURN:
if (dir_level < 0)
dir_level = 0;

base_pos = (int)base_pos_list[dir_level];
rel_pos = (int)rel_pos_list[dir_level];
dirUpCloseArchive();
Expand Down
5 changes: 5 additions & 0 deletions browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#ifndef __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 char cur_file[MAX_PATH_LENGTH];
Expand Down
4 changes: 0 additions & 4 deletions file.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@
#define MAX_NAME_LENGTH 256
#define MAX_SHORT_NAME_LENGTH 64
#define MAX_MOUNT_POINT_LENGTH 16
#define MAX_DIR_LEVELS 32

#define DIRECTORY_SIZE (4 * 1024)
#define TRANSFER_SIZE (128 * 1024)

#define HOME_PATH "home"
#define DIR_UP ".."

#define SYMLINK_HEADER_SIZE 4
#define SYMLINK_MAX_SIZE (SYMLINK_HEADER_SIZE + MAX_PATH_LENGTH)
#define SYMLINK_EXT "lnk"
Expand Down
1 change: 1 addition & 0 deletions psarc.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "main.h"
#include "browser.h"
#include "psarc.h"
#include "file.h"
#include "utils.h"
Expand Down

0 comments on commit a482994

Please sign in to comment.