1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
(*
Tux Commander - UError - Error system functions
Copyright (C) 2009 Tomas Bzatek <tbzatek@users.sourceforge.net>
Check for updates on tuxcmd.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
*)
unit UError;
interface
uses glib2, gdk2, Classes, ULibc;
// Ported from gioerror.h
type GIOErrorEnum = (G_IO_ERROR_FAILED,
G_IO_ERROR_NOT_FOUND,
G_IO_ERROR_EXISTS,
G_IO_ERROR_IS_DIRECTORY,
G_IO_ERROR_NOT_DIRECTORY,
G_IO_ERROR_NOT_EMPTY,
G_IO_ERROR_NOT_REGULAR_FILE,
G_IO_ERROR_NOT_SYMBOLIC_LINK,
G_IO_ERROR_NOT_MOUNTABLE_FILE,
G_IO_ERROR_FILENAME_TOO_LONG,
G_IO_ERROR_INVALID_FILENAME,
G_IO_ERROR_TOO_MANY_LINKS,
G_IO_ERROR_NO_SPACE,
G_IO_ERROR_INVALID_ARGUMENT,
G_IO_ERROR_PERMISSION_DENIED,
G_IO_ERROR_NOT_SUPPORTED,
G_IO_ERROR_NOT_MOUNTED,
G_IO_ERROR_ALREADY_MOUNTED,
G_IO_ERROR_CLOSED,
G_IO_ERROR_CANCELLED,
G_IO_ERROR_PENDING,
G_IO_ERROR_READ_ONLY,
G_IO_ERROR_CANT_CREATE_BACKUP,
G_IO_ERROR_WRONG_ETAG,
G_IO_ERROR_TIMED_OUT,
G_IO_ERROR_WOULD_RECURSE,
G_IO_ERROR_BUSY,
G_IO_ERROR_WOULD_BLOCK,
G_IO_ERROR_HOST_NOT_FOUND,
G_IO_ERROR_WOULD_MERGE,
G_IO_ERROR_FAILED_HANDLED,
G_IO_ERROR_TOO_MANY_OPEN_FILES,
G_IO_ERROR_NOT_INITIALIZED,
G_IO_ERROR_ADDRESS_IN_USE,
G_IO_ERROR_PARTIAL_INPUT,
G_IO_ERROR_INVALID_DATA);
function g_io_error_quark: TGQuark;
function G_IO_ERROR: TGQuark;
function g_io_error_from_errno(err_no: gint): GIOErrorEnum;
implementation
uses SysUtils, UCoreUtils, UGnome;
(********************************************************************************************************************************)
function g_io_error_quark: TGQuark;
begin
Result := g_quark_from_static_string('g-io-error-quark');
end;
function G_IO_ERROR: TGQuark;
begin
Result := g_io_error_quark;
end;
function g_io_error_from_errno(err_no: gint): GIOErrorEnum;
begin
case err_no of
EEXIST: Result := G_IO_ERROR_EXISTS;
EISDIR: Result := G_IO_ERROR_IS_DIRECTORY;
EACCES: Result := G_IO_ERROR_PERMISSION_DENIED;
ENAMETOOLONG: Result := G_IO_ERROR_FILENAME_TOO_LONG;
ENOENT: Result := G_IO_ERROR_NOT_FOUND;
ENOTDIR: Result := G_IO_ERROR_NOT_DIRECTORY;
EROFS: Result := G_IO_ERROR_READ_ONLY;
ELOOP: Result := G_IO_ERROR_TOO_MANY_LINKS;
ENOSPC: Result := G_IO_ERROR_NO_SPACE;
ENOMEM: Result := G_IO_ERROR_NO_SPACE;
EINVAL: Result := G_IO_ERROR_INVALID_ARGUMENT;
EPERM: Result := G_IO_ERROR_PERMISSION_DENIED;
ECANCELED: Result := G_IO_ERROR_CANCELLED;
ENOTEMPTY: Result := G_IO_ERROR_NOT_EMPTY;
ENOTSUP: Result := G_IO_ERROR_NOT_SUPPORTED;
ETIMEDOUT: Result := G_IO_ERROR_TIMED_OUT;
EBUSY: Result := G_IO_ERROR_BUSY;
EAGAIN: Result := G_IO_ERROR_WOULD_BLOCK;
EMFILE: Result := G_IO_ERROR_TOO_MANY_OPEN_FILES;
EADDRINUSE: Result := G_IO_ERROR_ADDRESS_IN_USE;
else Result := G_IO_ERROR_FAILED;
end;
end;
end.
|