Rev 9471 | Rev 9534 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9471 | Rev 9505 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | FILE_EXISTS, |
12 | FILE_EXISTS, |
13 | FILE_REPLACE, |
13 | FILE_REPLACE, |
14 | FILE_SKIP, |
14 | FILE_SKIP, |
15 | }; |
15 | }; |
Line -... | Line 16... | ||
- | 16 | ||
- | 17 | #define WRITE_ERROR_DEBUG 0 |
|
- | 18 | #define WRITE_ERROR_NOTIFY 1 |
|
- | 19 | :int writing_error_channel = WRITE_ERROR_DEBUG; |
|
16 | 20 | ||
Line 17... | Line 21... | ||
17 | int copy_state = FILE_DEFAULT; |
21 | int copy_state = FILE_DEFAULT; |
18 | 22 | ||
19 | :int copyf(dword from1, in1) |
23 | :int copyf(dword from1, in1) |
Line 79... | Line 83... | ||
79 | else { |
83 | else { |
80 | if (error = CopyFileAtOnce(CopyFile_atr.sizelo, copy_from3, copy_in3)) |
84 | if (error = CopyFileAtOnce(CopyFile_atr.sizelo, copy_from3, copy_in3)) |
81 | debugln("Error: CopyFile->CopyFileAtOnce"); |
85 | debugln("Error: CopyFile->CopyFileAtOnce"); |
82 | } |
86 | } |
83 | } |
87 | } |
84 | if (error) debug_error(copy_from3, error); |
88 | if (error) write_error(copy_from3, error); |
85 | return error; |
89 | return error; |
86 | } |
90 | } |
Line 87... | Line 91... | ||
87 | 91 | ||
88 | :int CopyFolder(dword from2, in2) |
92 | :int CopyFolder(dword from2, in2) |
Line 91... | Line 95... | ||
91 | char copy_from2[4096], copy_in2[4096], error; |
95 | char copy_from2[4096], copy_in2[4096], error; |
Line 92... | Line 96... | ||
92 | 96 | ||
93 | if (error = GetDir(#dirbuf, #fcount, from2, DIRS_ONLYREAL)) |
97 | if (error = GetDir(#dirbuf, #fcount, from2, DIRS_ONLYREAL)) |
94 | { |
98 | { |
95 | debugln("Error: CopyFolder->GetDir"); |
99 | debugln("Error: CopyFolder->GetDir"); |
96 | debug_error(from2, error); |
100 | write_error(from2, error); |
97 | free(dirbuf); |
101 | free(dirbuf); |
98 | return error; |
102 | return error; |
Line 99... | Line 103... | ||
99 | } |
103 | } |
100 | 104 | ||
101 | if (chrnum(in2, '/')>2) && (error = CreateDir(in2)) |
105 | if (chrnum(in2, '/')>2) && (error = CreateDir(in2)) |
102 | { |
106 | { |
103 | debugln("Error: CopyFolder->CreateDir"); |
107 | debugln("Error: CopyFolder->CreateDir"); |
104 | debug_error(in2, error); |
108 | write_error(in2, error); |
105 | free(dirbuf); |
109 | free(dirbuf); |
Line 106... | Line 110... | ||
106 | return error; |
110 | return error; |
Line 169... | Line 173... | ||
169 | "訡ª #32: ᫨誮¬ ¬®£® ¯à®æ¥áᮢ", 0}; |
173 | "訡ª #32: ᫨誮¬ ¬®£® ¯à®æ¥áᮢ", 0}; |
170 | #else |
174 | #else |
171 | unsigned char *ERROR_TEXT[]={ |
175 | unsigned char *ERROR_TEXT[]={ |
172 | "Code #0 - No error", |
176 | "Code #0 - No error", |
173 | "Error #1 - Base or partition of a hard disk is not defined", |
177 | "Error #1 - Base or partition of a hard disk is not defined", |
174 | "Error #2 - Function isn't supported for this file system", |
178 | "Error #2 - Function is not supported for this file system", |
175 | "Error #3 - Unknown file system", |
179 | "Error #3 - Unknown file system", |
176 | 0, |
180 | 0, |
177 | "Error #5 - File or folder not found", |
181 | "Error #5 - File or folder not found", |
178 | "Error #6 - End of file", |
182 | "Error #6 - End of file", |
179 | "Error #7 - Pointer lies outside of application memory", |
183 | "Error #7 - Pointer lies outside of application memory", |
Line 186... | Line 190... | ||
186 | "Error #30 - Not enough memory", |
190 | "Error #30 - Not enough memory", |
187 | "Error #31 - File is not executable", |
191 | "Error #31 - File is not executable", |
188 | "Error #32 - Too many processes", 0}; |
192 | "Error #32 - Too many processes", 0}; |
189 | #endif |
193 | #endif |
Line 190... | Line 194... | ||
190 | 194 | ||
191 | :dword get_error(int N) |
195 | :dword get_error(int error_number) |
192 | { |
196 | { |
193 | char error[256]; |
197 | char error_message[256]; |
- | 198 | error_number = fabs(error_number); |
|
194 | N = fabs(N); |
199 | if (error_number<=33) { |
- | 200 | strcpy(#error_message, ERROR_TEXT[error_number]); |
|
195 | if (N<=33) strcpy(#error, ERROR_TEXT[N]); |
201 | } else { |
- | 202 | miniprintf(#error_message,"%i - Unknown error number O_o",error_number); |
|
196 | else sprintf(#error,"%d%s",N," - Unknown error number O_o"); |
203 | } |
197 | return #error; |
204 | return #error_message; |
Line 198... | Line 205... | ||
198 | } |
205 | } |
199 | 206 | ||
- | 207 | :void write_error(dword path, error_number) |
|
200 | :void debug_error(dword path, error_number) |
208 | { |
201 | { |
209 | char notify_message[100]; |
- | 210 | if (path) debugln(path); |
|
- | 211 | debugln(get_error(error_number)); |
|
- | 212 | if (writing_error_channel == WRITE_ERROR_NOTIFY) { |
|
- | 213 | miniprintf(#notify_message, "'%s' -E", get_error(error_number)); |
|
202 | if (path) debugln(path); |
214 | notify(#notify_message); |
Line 203... | Line 215... | ||
203 | debugln(get_error(error_number)); |
215 | } |
204 | } |
216 | } |