summaryrefslogtreecommitdiff
path: root/vfs
diff options
context:
space:
mode:
Diffstat (limited to 'vfs')
-rw-r--r--vfs/UVFSCore.pas22
-rw-r--r--vfs/common/vfs_types.h114
-rw-r--r--vfs/uVFSprototypes.pas14
3 files changed, 22 insertions, 128 deletions
diff --git a/vfs/UVFSCore.pas b/vfs/UVFSCore.pas
index c1e8fd4..539295d 100644
--- a/vfs/UVFSCore.pas
+++ b/vfs/UVFSCore.pas
@@ -167,7 +167,7 @@ const ConstGlobalModulePath1 = '/usr/lib/tuxcmd';
ConstLocalModulePath2 = './plugins';
ConstLocalModulePath3 = '../lib/tuxcmd';
- ConstVFSVersionRequired = 2;
+ ConstVFSVersionRequired = cVFSVersion;
var BinaryPath: string;
@@ -302,7 +302,7 @@ begin
{
DebugMsg(['sizeof(TVFSItem) = ', sizeof(TVFSItem)]);
- DebugMsg(['sizeof(TVFSItem.sFileName) = ', sizeof(TVFSItem.sFileName)]);
+ DebugMsg(['sizeof(TVFSItem.FName) = ', sizeof(TVFSItem.FName)]);
DebugMsg(['sizeof(TVFSItem.iSize) = ', sizeof(TVFSItem.iSize)]);
DebugMsg(['sizeof(TVFSItem.m_time) = ', sizeof(TVFSItem.m_time)]);
DebugMsg(['sizeof(TVFSItem.a_time) = ', sizeof(TVFSItem.a_time)]);
@@ -369,7 +369,7 @@ begin
repeat
// DebugMsg(['begin--']);
- if AddDotFiles or (not ((Length(P^.sFileName) > 1) and (P^.sFileName[0] = '.') and (P^.sFileName[1] <> '.'))) then begin
+ if AddDotFiles or (not ((Length(P^.FName) > 1) and (P^.FName[0] = '.') and (P^.FName[1] <> '.'))) then begin
// DebugMsg(['Checkpoint 1']);
Item := malloc(SizeOf(TDataItem));
memset(Item, 0, SizeOf(TDataItem));
@@ -378,8 +378,8 @@ begin
// DebugMsg(['Checkpoint 3']);
with Item^ do
try
- FName := strdup(P^.sFileName);
- FDisplayName := StrToUTF8(P^.sFileName);
+ FName := strdup(P^.FName);
+ FDisplayName := strdup(P^.FDisplayName);
if P^.sLinkTo <> nil
then begin
LnkPointTo := strdup(P^.sLinkTo);
@@ -572,9 +572,11 @@ begin
Item := malloc(SizeOf(TDataItemSL));
memset(Item, 0, SizeOf(TDataItemSL));
with Item^ do begin
-{ FName := strdup(P^.sFileName);
- FDisplayName := StrToUTF8(P^.sFileName); }
+{ FName := strdup(P^.FName);
+ FDisplayName := StrToUTF8(P^.FName); }
FName := strdup(PChar(APath));
+
+ //* TODO
FDisplayName := StrToUTF8(PChar(APath));
if P^.sLinkTo <> nil then LnkPointTo := strdup(P^.sLinkTo)
else LnkPointTo := nil;
@@ -635,6 +637,8 @@ var Item: PDataItemSL;
// AName := malloc(Length(FPath) + 1);
// memset(AName, 0, Length(FPath) + 1);
FName := strdup(PChar(FPath));
+
+ //* TODO
FDisplayName := StrToUTF8(PChar(FPath));
if P^.sLinkTo <> nil then LnkPointTo := strdup(P^.sLinkTo)
else LnkPointTo := nil;
@@ -689,8 +693,8 @@ begin
repeat
if TVFSItemType(P^.ItemType) = vDirectory
- then LocalList.Add(APath + String(P^.sFileName))
- else AddEntry(APath + String(P^.sFileName), False, True);
+ then LocalList.Add(APath + String(P^.FName))
+ else AddEntry(APath + String(P^.FName), False, True);
libc_free(P);
P := malloc(SizeOf(TVFSItem));
memset(P, 0, SizeOf(TVFSItem));
diff --git a/vfs/common/vfs_types.h b/vfs/common/vfs_types.h
deleted file mode 100644
index 609a78b..0000000
--- a/vfs/common/vfs_types.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Tux Commander VFS: Virtual File System types and definitions
- * - prototypes functions and types
- * draft version 3
- *
- * Copyright (C) 2003 Radek Cervinka <radek.cervinka@centrum.cz>
- * Copyright (C) 2008 Tomas Bzatek <tbzatek@users.sourceforge.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __VFS_TYPES_H__
-#define __VFS_TYPES_H__
-
-
-#include <stdio.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-typedef int TVFSResult;
-
-
-typedef void (* TVFSLogFunc)(char *s);
-typedef int (* TVFSCopyCallBackFunc)(u_int64_t iPos, u_int64_t iMax, void *data);
-typedef void *TVFSFileDes;
-
-static const int cVFSVersion = 3; // current version of the VFS API
-
-// Capabilities
-static const int capVFS_nil = 0;
-static const int capVFS_List = 1 << 0;
-static const int capVFS_CopyOut = 1 << 1;
-static const int capVFS_CopyIn = 1 << 2;
-static const int capVFS_MkDir = 1 << 3;
-static const int capVFS_RmDir = 1 << 4;
-static const int capVFS_Multiple = 1 << 5; // support multiple files = background copy & thread safe
-static const int capVFS_Delete = 1 << 6;
-static const int capVFS_Rename = 1 << 7;
-static const int capVFS_Execute = 1 << 8;
-static const int capVFS_Append = 1 << 9;
-
-// Error codes (TVFSResult)
-enum {
- cVFS_OK = 0,
- cVFS_Failed = 1, // also No such file
- cVFS_Cancelled = 2,
- cVFS_Not_Supported = 3,
- cVFS_No_More_Files = 4,
- cVFS_ReadErr = 5,
- cVFS_WriteErr = 6, // also Readonly FileSystem
- cVFS_LoginFailed = 7,
- cVFS_PermissionDenied = 8,
- cVFS_NoSpaceLeft = 9,
- cVFS_mallocFailed = 10,
- cVFS_BadPassword = 11,
- cVFS_MissingVolume = 12,
- cVFS_CorruptedArchive = 13
-};
-
-
-// Open modes
-enum {
- cVFS_OpenRead,
- cVFS_OpenWrite,
- cVFS_OpenAppend
-};
-
-
-// Item Type enum
-enum TVFSItemType {
- vRegular = 0,
- vSymlink = 1,
- vChardev = 2,
- vBlockdev = 3,
- vDirectory = 4,
- vFifo = 5,
- vSock = 6,
- vOther = 7
-};
-
-
-struct TVFSItem {
- char *sFileName;
- u_int64_t iSize;
- __time_t m_time; // numbers should be located before the other variables (bug?)
- __time_t a_time;
- __time_t c_time;
- __mode_t iMode;
- char *sLinkTo;
- __uid_t iUID;
- __gid_t iGID;
- enum TVFSItemType ItemType;
-};
-
-struct TVFSInfo {
- const char *Name;
- const char *Description;
- const char *About;
- const char *Copyright;
-};
-
-
-#endif /* __VFS_TYPES_H__ */
diff --git a/vfs/uVFSprototypes.pas b/vfs/uVFSprototypes.pas
index dbc9547..df45ecb 100644
--- a/vfs/uVFSprototypes.pas
+++ b/vfs/uVFSprototypes.pas
@@ -28,7 +28,7 @@ unit uVFSprototypes;
interface
const
- cVFSVersion = 3; // current version of the VFS API
+ cVFSVersion = 4; // current version of the VFS API
// Capabilities
capVFS_nil = 0;
@@ -87,14 +87,15 @@ type
{$ENDIF}
-
-// All filenames should be UTF-8 as much as possible
+ //* TODO: FName/FDisplayName: napsat presne pravidla pro absolutni/relativni cesty a opravit v modulech i v UVFSCore
PVFSItem = ^TVFSItem;
TVFSItem = packed record
{$IFNDEF CPU64} // 32-bit platform
- sFileName: PChar;
+ FName: PChar;
+ // FDisplayName - plugins must ensure correct UTF-8 string
+ FDisplayName: PChar;
iSize: Int64;
m_time: DWORD;
a_time: DWORD;
@@ -105,7 +106,8 @@ type
iGID: Integer;
ItemType: TVFSItemType;
{$ELSE} // 64-bit platform
- sFileName: PChar;
+ FName: PChar;
+ FDisplayName: PChar;
iSize: Int64;
m_time: QWORD;
a_time: QWORD;
@@ -233,6 +235,8 @@ type
TVFSListFirst = function (g:TVFSGlobs; const sDir: PChar; VFSItem: PVFSItem): TVFSResult; cdecl;
TVFSListNext = function (g:TVFSGlobs; const sDir: PChar; VFSItem: PVFSItem): TVFSResult; cdecl;
TVFSListClose = function (g:TVFSGlobs): TVFSResult; cdecl;
+
+ //* TODO: napsat presne pravidla pro absolutni/relativni cesty a opravit v modulech i v UVFSCore
TVFSFileInfo = function (g:TVFSGlobs; AFileName: PChar; VFSItem: PVFSItem): TVFSResult; cdecl;
// Gets a single info item without need to list a whole directory