flyshell 1.4.2__tar.gz → 1.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flyshell-1.4.2/src/flyshell.egg-info → flyshell-1.4.3}/PKG-INFO +1 -1
- flyshell-1.4.3/c_src/diskops/shared/win32_utf.h +51 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/c_src/diskops/win32/cat.c +3 -8
- flyshell-1.4.3/c_src/diskops/win32/dir.c +107 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/c_src/diskops/win32/touch.c +3 -8
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/constants.py +2 -2
- {flyshell-1.4.2 → flyshell-1.4.3/src/flyshell.egg-info}/PKG-INFO +1 -1
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell.egg-info/SOURCES.txt +1 -0
- flyshell-1.4.2/c_src/diskops/win32/dir.c +0 -65
- {flyshell-1.4.2 → flyshell-1.4.3}/LICENSE +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/MANIFEST.in +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/README.md +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/c_src/diskops/diskops.c +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/c_src/diskops/posix/cat.c +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/c_src/diskops/posix/dir.c +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/c_src/diskops/posix/touch.c +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/c_src/diskops/shared/dir_types.c +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/c_src/diskops/shared/dir_types.h +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/c_src/diskops/shared/native_errors.h +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/pyproject.toml +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/setup.cfg +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/setup.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/__init__.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/abstract/__init__.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/abstract/base_cmd.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/abstract/base_plugin.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/abstract/parent_cmd.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/accounts/__init__.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/accounts/auth.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/bin/__init__.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/builtin/__init__.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/builtin/diskops.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/builtin/fs.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/builtin/pkg.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/builtin/system.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/builtin/utils.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/core/__init__.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/core/console.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/core/data.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/core/directory.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/main.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/native/__init__.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/native/diskops_bridge.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/native/diskops_handler.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/native/legacy/__init__.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/native/legacy/diskops.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/startup/__init__.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/startup/deps.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/startup/env.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell/startup/loader.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell.egg-info/dependency_links.txt +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell.egg-info/entry_points.txt +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell.egg-info/requires.txt +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/src/flyshell.egg-info/top_level.txt +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_auth.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_data.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_deps.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_directory.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_diskops_ext.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_diskops_lgc.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_diskops_old.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_env.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_fs.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_loader.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_pkg.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_security.py +0 -0
- {flyshell-1.4.2 → flyshell-1.4.3}/tests/test_utils.py +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// c_src/diskops/shared/win32_utf.h
|
|
2
|
+
|
|
3
|
+
#ifndef WIN32_UTF_H
|
|
4
|
+
#define WIN32_UTF_H
|
|
5
|
+
|
|
6
|
+
#ifdef _WIN32
|
|
7
|
+
|
|
8
|
+
#include <stdlib.h>
|
|
9
|
+
#include <windows.h>
|
|
10
|
+
|
|
11
|
+
static inline wchar_t *utf8_to_wide(const char *utf8_str) {
|
|
12
|
+
if (!utf8_str) {
|
|
13
|
+
return NULL;
|
|
14
|
+
}
|
|
15
|
+
int wlen = MultiByteToWideChar(CP_UTF8, 0, utf8_str, -1, NULL, 0);
|
|
16
|
+
if (wlen <= 0) {
|
|
17
|
+
return NULL;
|
|
18
|
+
}
|
|
19
|
+
wchar_t *wstr = (wchar_t *)malloc((size_t)wlen * sizeof(wchar_t));
|
|
20
|
+
if (!wstr) {
|
|
21
|
+
return NULL;
|
|
22
|
+
}
|
|
23
|
+
if (MultiByteToWideChar(CP_UTF8, 0, utf8_str, -1, wstr, wlen) <= 0) {
|
|
24
|
+
free(wstr);
|
|
25
|
+
return NULL;
|
|
26
|
+
}
|
|
27
|
+
return wstr;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static inline char *wide_to_utf8(const wchar_t *wstr) {
|
|
31
|
+
if (!wstr) {
|
|
32
|
+
return NULL;
|
|
33
|
+
}
|
|
34
|
+
int ulen = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
|
|
35
|
+
if (ulen <= 0) {
|
|
36
|
+
return NULL;
|
|
37
|
+
}
|
|
38
|
+
char *utf8_str = (char *)malloc((size_t)ulen * sizeof(char));
|
|
39
|
+
if (!utf8_str) {
|
|
40
|
+
return NULL;
|
|
41
|
+
}
|
|
42
|
+
if (WideCharToMultiByte(CP_UTF8, 0, wstr, -1, utf8_str, ulen, NULL, NULL) <= 0) {
|
|
43
|
+
free(utf8_str);
|
|
44
|
+
return NULL;
|
|
45
|
+
}
|
|
46
|
+
return utf8_str;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#endif /* _WIN32 */
|
|
50
|
+
|
|
51
|
+
#endif /* WIN32_UTF_H */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// c_src/diskops/win32/cat.c
|
|
2
2
|
|
|
3
3
|
#include "../shared/native_errors.h"
|
|
4
|
+
#include "../shared/win32_utf.h"
|
|
4
5
|
#include <stdlib.h>
|
|
5
6
|
#include <windows.h>
|
|
6
7
|
|
|
@@ -11,16 +12,10 @@ Result cat(const char *path, char **out_buf, size_t *out_size) {
|
|
|
11
12
|
*out_buf = NULL;
|
|
12
13
|
*out_size = 0;
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
if (wlen <= 0) {
|
|
16
|
-
return ERR_INVALID_PATH;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
wchar_t *wpath = (wchar_t *)malloc(wlen * sizeof(wchar_t));
|
|
15
|
+
wchar_t *wpath = utf8_to_wide(path);
|
|
20
16
|
if (!wpath) {
|
|
21
|
-
return
|
|
17
|
+
return ERR_INVALID_PATH;
|
|
22
18
|
}
|
|
23
|
-
MultiByteToWideChar(CP_UTF8, 0, path, -1, wpath, wlen);
|
|
24
19
|
|
|
25
20
|
HANDLE hFile =
|
|
26
21
|
CreateFileW(wpath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// c_src/diskops/win32/dir.c
|
|
2
|
+
|
|
3
|
+
#include "../shared/dir_types.h"
|
|
4
|
+
#include "../shared/native_errors.h"
|
|
5
|
+
#include "../shared/win32_utf.h"
|
|
6
|
+
#include <stdlib.h>
|
|
7
|
+
#include <string.h>
|
|
8
|
+
#include <windows.h>
|
|
9
|
+
|
|
10
|
+
Result list_dir(const char *path, DirList *out_list) {
|
|
11
|
+
if (!path || path[0] == '\0' || !out_list) {
|
|
12
|
+
return ERR_INVALID_PATH;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
out_list->entries = NULL;
|
|
16
|
+
out_list->count = 0;
|
|
17
|
+
|
|
18
|
+
wchar_t *wpath = utf8_to_wide(path);
|
|
19
|
+
if (!wpath) {
|
|
20
|
+
return ERR_INVALID_PATH;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
DWORD attrs = GetFileAttributesW(wpath);
|
|
24
|
+
if (attrs == INVALID_FILE_ATTRIBUTES) {
|
|
25
|
+
DWORD err = GetLastError();
|
|
26
|
+
free(wpath);
|
|
27
|
+
return map_win32_error(err);
|
|
28
|
+
}
|
|
29
|
+
if ((attrs & FILE_ATTRIBUTE_DIRECTORY) == 0) {
|
|
30
|
+
free(wpath);
|
|
31
|
+
return ERR_NOT_DIR;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
size_t wlen = wcslen(wpath);
|
|
35
|
+
bool has_sep = (wlen > 0 && (wpath[wlen - 1] == L'\\' || wpath[wlen - 1] == L'/')) != 0;
|
|
36
|
+
size_t pat_len = wlen + (has_sep ? 1 : 2) + 1;
|
|
37
|
+
|
|
38
|
+
wchar_t *wpattern = (wchar_t *)malloc(pat_len * sizeof(wchar_t));
|
|
39
|
+
if (!wpattern) {
|
|
40
|
+
free(wpath);
|
|
41
|
+
return ERR_IO;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
memcpy(wpattern, wpath, wlen * sizeof(wchar_t));
|
|
45
|
+
size_t pos = wlen;
|
|
46
|
+
if (!has_sep) {
|
|
47
|
+
wpattern[pos++] = L'\\';
|
|
48
|
+
}
|
|
49
|
+
wpattern[pos++] = L'*';
|
|
50
|
+
wpattern[pos] = L'\0';
|
|
51
|
+
free(wpath);
|
|
52
|
+
|
|
53
|
+
WIN32_FIND_DATAW find_data;
|
|
54
|
+
HANDLE h_find = FindFirstFileW(wpattern, &find_data);
|
|
55
|
+
DWORD find_err = GetLastError();
|
|
56
|
+
free(wpattern);
|
|
57
|
+
|
|
58
|
+
if (h_find == INVALID_HANDLE_VALUE) {
|
|
59
|
+
return map_win32_error(find_err);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
size_t capacity = 16;
|
|
63
|
+
out_list->entries = (DirEntry *)malloc(capacity * sizeof(DirEntry));
|
|
64
|
+
if (!out_list->entries) {
|
|
65
|
+
FindClose(h_find);
|
|
66
|
+
return ERR_IO;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
do {
|
|
70
|
+
if (wcscmp(find_data.cFileName, L".") == 0 || wcscmp(find_data.cFileName, L"..") == 0) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (out_list->count >= capacity) {
|
|
75
|
+
capacity *= 2;
|
|
76
|
+
DirEntry *resized = (DirEntry *)realloc(out_list->entries, capacity * sizeof(DirEntry));
|
|
77
|
+
if (!resized) {
|
|
78
|
+
FindClose(h_find);
|
|
79
|
+
free_dir_list(out_list);
|
|
80
|
+
return ERR_IO;
|
|
81
|
+
}
|
|
82
|
+
out_list->entries = resized;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
char *utf8_name = wide_to_utf8(find_data.cFileName);
|
|
86
|
+
if (!utf8_name) {
|
|
87
|
+
FindClose(h_find);
|
|
88
|
+
free_dir_list(out_list);
|
|
89
|
+
return ERR_DECODE;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
bool is_dir = (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
|
93
|
+
out_list->entries[out_list->count].name = utf8_name;
|
|
94
|
+
out_list->entries[out_list->count].is_dir = is_dir;
|
|
95
|
+
out_list->count++;
|
|
96
|
+
} while (FindNextFileW(h_find, &find_data) != 0);
|
|
97
|
+
|
|
98
|
+
DWORD err = GetLastError();
|
|
99
|
+
FindClose(h_find);
|
|
100
|
+
|
|
101
|
+
if (err != ERROR_NO_MORE_FILES && err != ERROR_SUCCESS) {
|
|
102
|
+
free_dir_list(out_list);
|
|
103
|
+
return map_win32_error(err);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return SUCCESS;
|
|
107
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// c_src/diskops/win32/touch.c
|
|
2
2
|
|
|
3
3
|
#include "../shared/native_errors.h"
|
|
4
|
+
#include "../shared/win32_utf.h"
|
|
4
5
|
#include <stdlib.h>
|
|
5
6
|
#include <windows.h>
|
|
6
7
|
|
|
@@ -9,16 +10,10 @@ Result touch(const char *path) {
|
|
|
9
10
|
return ERR_INVALID_PATH;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
if (wlen <= 0) {
|
|
14
|
-
return ERR_INVALID_PATH;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
wchar_t *wpath = (wchar_t *)malloc(wlen * sizeof(wchar_t));
|
|
13
|
+
wchar_t *wpath = utf8_to_wide(path);
|
|
18
14
|
if (!wpath) {
|
|
19
|
-
return
|
|
15
|
+
return ERR_INVALID_PATH;
|
|
20
16
|
}
|
|
21
|
-
MultiByteToWideChar(CP_UTF8, 0, path, -1, wpath, wlen);
|
|
22
17
|
|
|
23
18
|
DWORD attrs = GetFileAttributesW(wpath);
|
|
24
19
|
if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY)) {
|
|
@@ -10,6 +10,7 @@ c_src/diskops/posix/touch.c
|
|
|
10
10
|
c_src/diskops/shared/dir_types.c
|
|
11
11
|
c_src/diskops/shared/dir_types.h
|
|
12
12
|
c_src/diskops/shared/native_errors.h
|
|
13
|
+
c_src/diskops/shared/win32_utf.h
|
|
13
14
|
c_src/diskops/win32/cat.c
|
|
14
15
|
c_src/diskops/win32/dir.c
|
|
15
16
|
c_src/diskops/win32/touch.c
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// c_src/diskops/win32/dir.c
|
|
2
|
-
|
|
3
|
-
#include "../shared/dir_types.h"
|
|
4
|
-
#include "../shared/native_errors.h"
|
|
5
|
-
#include <stdio.h>
|
|
6
|
-
#include <stdlib.h>
|
|
7
|
-
#include <string.h>
|
|
8
|
-
#include <windows.h>
|
|
9
|
-
|
|
10
|
-
Result list_dir(const char *path, DirList *out_list) {
|
|
11
|
-
if (!path || path[0] == '\0' || !out_list) {
|
|
12
|
-
return ERR_INVALID_PATH;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
out_list->entries = NULL;
|
|
16
|
-
out_list->count = 0;
|
|
17
|
-
|
|
18
|
-
char search_pattern[MAX_PATH];
|
|
19
|
-
snprintf(search_pattern, sizeof(search_pattern), "%s\\*", path);
|
|
20
|
-
|
|
21
|
-
WIN32_FIND_DATAA find_data;
|
|
22
|
-
HANDLE h_find = FindFirstFileA(search_pattern, &find_data);
|
|
23
|
-
if (h_find == INVALID_HANDLE_VALUE) {
|
|
24
|
-
return map_win32_error(GetLastError());
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
size_t capacity = 16;
|
|
28
|
-
out_list->entries = (DirEntry *)malloc(capacity * sizeof(DirEntry));
|
|
29
|
-
if (!out_list->entries) {
|
|
30
|
-
FindClose(h_find);
|
|
31
|
-
return ERR_IO;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
do {
|
|
35
|
-
if (strcmp(find_data.cFileName, ".") == 0 || strcmp(find_data.cFileName, "..") == 0) {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (out_list->count >= capacity) {
|
|
40
|
-
capacity *= 2;
|
|
41
|
-
DirEntry *resized = (DirEntry *)realloc(out_list->entries, capacity * sizeof(DirEntry));
|
|
42
|
-
if (!resized) {
|
|
43
|
-
FindClose(h_find);
|
|
44
|
-
free_dir_list(out_list);
|
|
45
|
-
return ERR_IO;
|
|
46
|
-
}
|
|
47
|
-
out_list->entries = resized;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
bool is_dir = (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
|
51
|
-
out_list->entries[out_list->count].name = _strdup(find_data.cFileName);
|
|
52
|
-
out_list->entries[out_list->count].is_dir = is_dir;
|
|
53
|
-
out_list->count++;
|
|
54
|
-
} while (FindNextFileA(h_find, &find_data) != 0);
|
|
55
|
-
|
|
56
|
-
DWORD err = GetLastError();
|
|
57
|
-
FindClose(h_find);
|
|
58
|
-
|
|
59
|
-
if (err != ERROR_NO_MORE_FILES && err != ERROR_SUCCESS) {
|
|
60
|
-
free_dir_list(out_list);
|
|
61
|
-
return map_win32_error(err);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return SUCCESS;
|
|
65
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|