1 |
|
/* |
2 |
|
* extfs_amiga.cpp - MacOS file system for access native file system access, AmigaOS specific stuff |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2000 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2002 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
153 |
|
}; |
154 |
|
|
155 |
|
static const ext2type e2t_translation[] = { |
156 |
< |
{".Z", 'ZIVM', 'LZIV'}, |
157 |
< |
{".gz", 'Gzip', 'Gzip'}, |
158 |
< |
{".hqx", 'TEXT', 'SITx'}, |
159 |
< |
{".pdf", 'PDF ', 'CARO'}, |
160 |
< |
{".ps", 'TEXT', 'ttxt'}, |
161 |
< |
{".sit", 'SIT!', 'SITx'}, |
162 |
< |
{".tar", 'TARF', 'TAR '}, |
163 |
< |
{".uu", 'TEXT', 'SITx'}, |
164 |
< |
{".uue", 'TEXT', 'SITx'}, |
165 |
< |
{".zip", 'ZIP ', 'ZIP '}, |
166 |
< |
{".8svx", '8SVX', 'SNDM'}, |
167 |
< |
{".aifc", 'AIFC', 'TVOD'}, |
168 |
< |
{".aiff", 'AIFF', 'TVOD'}, |
169 |
< |
{".au", 'ULAW', 'TVOD'}, |
170 |
< |
{".mid", 'MIDI', 'TVOD'}, |
171 |
< |
{".midi", 'MIDI', 'TVOD'}, |
172 |
< |
{".mp2", 'MPG ', 'TVOD'}, |
173 |
< |
{".mp3", 'MPG ', 'TVOD'}, |
174 |
< |
{".wav", 'WAVE', 'TVOD'}, |
175 |
< |
{".bmp", 'BMPf', 'ogle'}, |
176 |
< |
{".gif", 'GIFf', 'ogle'}, |
177 |
< |
{".lbm", 'ILBM', 'GKON'}, |
178 |
< |
{".ilbm", 'ILBM', 'GKON'}, |
179 |
< |
{".jpg", 'JPEG', 'ogle'}, |
180 |
< |
{".jpeg", 'JPEG', 'ogle'}, |
181 |
< |
{".pict", 'PICT', 'ogle'}, |
182 |
< |
{".png", 'PNGf', 'ogle'}, |
183 |
< |
{".sgi", '.SGI', 'ogle'}, |
184 |
< |
{".tga", 'TPIC', 'ogle'}, |
185 |
< |
{".tif", 'TIFF', 'ogle'}, |
186 |
< |
{".tiff", 'TIFF', 'ogle'}, |
187 |
< |
{".htm", 'TEXT', 'MOSS'}, |
188 |
< |
{".html", 'TEXT', 'MOSS'}, |
189 |
< |
{".txt", 'TEXT', 'ttxt'}, |
190 |
< |
{".rtf", 'TEXT', 'MSWD'}, |
191 |
< |
{".c", 'TEXT', 'R*ch'}, |
192 |
< |
{".C", 'TEXT', 'R*ch'}, |
193 |
< |
{".cc", 'TEXT', 'R*ch'}, |
194 |
< |
{".cpp", 'TEXT', 'R*ch'}, |
195 |
< |
{".cxx", 'TEXT', 'R*ch'}, |
196 |
< |
{".h", 'TEXT', 'R*ch'}, |
197 |
< |
{".hh", 'TEXT', 'R*ch'}, |
198 |
< |
{".hpp", 'TEXT', 'R*ch'}, |
199 |
< |
{".hxx", 'TEXT', 'R*ch'}, |
200 |
< |
{".s", 'TEXT', 'R*ch'}, |
201 |
< |
{".S", 'TEXT', 'R*ch'}, |
202 |
< |
{".i", 'TEXT', 'R*ch'}, |
203 |
< |
{".mpg", 'MPEG', 'TVOD'}, |
204 |
< |
{".mpeg", 'MPEG', 'TVOD'}, |
205 |
< |
{".mov", 'MooV', 'TVOD'}, |
206 |
< |
{".fli", 'FLI ', 'TVOD'}, |
207 |
< |
{".avi", 'VfW ', 'TVOD'}, |
208 |
< |
{".qxd", 'XDOC', 'XPR3'}, |
209 |
< |
{".hfv", 'DDim', 'ddsk'}, |
210 |
< |
{".dsk", 'DDim', 'ddsk'}, |
211 |
< |
{".img", 'rohd', 'ddsk'}, |
156 |
> |
{".z", FOURCC('Z','I','V','M'), FOURCC('L','Z','I','V')}, |
157 |
> |
{".gz", FOURCC('G','z','i','p'), FOURCC('G','z','i','p')}, |
158 |
> |
{".hqx", FOURCC('T','E','X','T'), FOURCC('S','I','T','x')}, |
159 |
> |
{".bin", FOURCC('T','E','X','T'), FOURCC('S','I','T','x')}, |
160 |
> |
{".pdf", FOURCC('P','D','F',' '), FOURCC('C','A','R','O')}, |
161 |
> |
{".ps", FOURCC('T','E','X','T'), FOURCC('t','t','x','t')}, |
162 |
> |
{".sit", FOURCC('S','I','T','!'), FOURCC('S','I','T','x')}, |
163 |
> |
{".tar", FOURCC('T','A','R','F'), FOURCC('T','A','R',' ')}, |
164 |
> |
{".uu", FOURCC('T','E','X','T'), FOURCC('S','I','T','x')}, |
165 |
> |
{".uue", FOURCC('T','E','X','T'), FOURCC('S','I','T','x')}, |
166 |
> |
{".zip", FOURCC('Z','I','P',' '), FOURCC('Z','I','P',' ')}, |
167 |
> |
{".8svx", FOURCC('8','S','V','X'), FOURCC('S','N','D','M')}, |
168 |
> |
{".aifc", FOURCC('A','I','F','C'), FOURCC('T','V','O','D')}, |
169 |
> |
{".aiff", FOURCC('A','I','F','F'), FOURCC('T','V','O','D')}, |
170 |
> |
{".au", FOURCC('U','L','A','W'), FOURCC('T','V','O','D')}, |
171 |
> |
{".mid", FOURCC('M','I','D','I'), FOURCC('T','V','O','D')}, |
172 |
> |
{".midi", FOURCC('M','I','D','I'), FOURCC('T','V','O','D')}, |
173 |
> |
{".mp2", FOURCC('M','P','G',' '), FOURCC('T','V','O','D')}, |
174 |
> |
{".mp3", FOURCC('M','P','G',' '), FOURCC('T','V','O','D')}, |
175 |
> |
{".wav", FOURCC('W','A','V','E'), FOURCC('T','V','O','D')}, |
176 |
> |
{".bmp", FOURCC('B','M','P','f'), FOURCC('o','g','l','e')}, |
177 |
> |
{".gif", FOURCC('G','I','F','f'), FOURCC('o','g','l','e')}, |
178 |
> |
{".lbm", FOURCC('I','L','B','M'), FOURCC('G','K','O','N')}, |
179 |
> |
{".ilbm", FOURCC('I','L','B','M'), FOURCC('G','K','O','N')}, |
180 |
> |
{".jpg", FOURCC('J','P','E','G'), FOURCC('o','g','l','e')}, |
181 |
> |
{".jpeg", FOURCC('J','P','E','G'), FOURCC('o','g','l','e')}, |
182 |
> |
{".pict", FOURCC('P','I','C','T'), FOURCC('o','g','l','e')}, |
183 |
> |
{".png", FOURCC('P','N','G','f'), FOURCC('o','g','l','e')}, |
184 |
> |
{".sgi", FOURCC('.','S','G','I'), FOURCC('o','g','l','e')}, |
185 |
> |
{".tga", FOURCC('T','P','I','C'), FOURCC('o','g','l','e')}, |
186 |
> |
{".tif", FOURCC('T','I','F','F'), FOURCC('o','g','l','e')}, |
187 |
> |
{".tiff", FOURCC('T','I','F','F'), FOURCC('o','g','l','e')}, |
188 |
> |
{".htm", FOURCC('T','E','X','T'), FOURCC('M','O','S','S')}, |
189 |
> |
{".html", FOURCC('T','E','X','T'), FOURCC('M','O','S','S')}, |
190 |
> |
{".txt", FOURCC('T','E','X','T'), FOURCC('t','t','x','t')}, |
191 |
> |
{".rtf", FOURCC('T','E','X','T'), FOURCC('M','S','W','D')}, |
192 |
> |
{".c", FOURCC('T','E','X','T'), FOURCC('R','*','c','h')}, |
193 |
> |
{".cc", FOURCC('T','E','X','T'), FOURCC('R','*','c','h')}, |
194 |
> |
{".cpp", FOURCC('T','E','X','T'), FOURCC('R','*','c','h')}, |
195 |
> |
{".cxx", FOURCC('T','E','X','T'), FOURCC('R','*','c','h')}, |
196 |
> |
{".h", FOURCC('T','E','X','T'), FOURCC('R','*','c','h')}, |
197 |
> |
{".hh", FOURCC('T','E','X','T'), FOURCC('R','*','c','h')}, |
198 |
> |
{".hpp", FOURCC('T','E','X','T'), FOURCC('R','*','c','h')}, |
199 |
> |
{".hxx", FOURCC('T','E','X','T'), FOURCC('R','*','c','h')}, |
200 |
> |
{".s", FOURCC('T','E','X','T'), FOURCC('R','*','c','h')}, |
201 |
> |
{".i", FOURCC('T','E','X','T'), FOURCC('R','*','c','h')}, |
202 |
> |
{".mpg", FOURCC('M','P','E','G'), FOURCC('T','V','O','D')}, |
203 |
> |
{".mpeg", FOURCC('M','P','E','G'), FOURCC('T','V','O','D')}, |
204 |
> |
{".mov", FOURCC('M','o','o','V'), FOURCC('T','V','O','D')}, |
205 |
> |
{".fli", FOURCC('F','L','I',' '), FOURCC('T','V','O','D')}, |
206 |
> |
{".avi", FOURCC('V','f','W',' '), FOURCC('T','V','O','D')}, |
207 |
> |
{".qxd", FOURCC('X','D','O','C'), FOURCC('X','P','R','3')}, |
208 |
> |
{".hfv", FOURCC('D','D','i','m'), FOURCC('d','d','s','k')}, |
209 |
> |
{".dsk", FOURCC('D','D','i','m'), FOURCC('d','d','s','k')}, |
210 |
> |
{".img", FOURCC('r','o','h','d'), FOURCC('d','d','s','k')}, |
211 |
|
{NULL, 0, 0} // End marker |
212 |
|
}; |
213 |
|
|
214 |
< |
void get_finfo(const char *path, uint32 finfo, uint32 fxinfo) |
214 |
> |
void get_finfo(const char *path, uint32 finfo, uint32 fxinfo, bool is_dir) |
215 |
|
{ |
216 |
|
// Set default finder info |
217 |
|
Mac_memset(finfo, 0, SIZEOF_FInfo); |
232 |
|
} |
233 |
|
|
234 |
|
// No Finder info file, translate file name extension to MacOS type/creator |
235 |
< |
struct stat st; |
237 |
< |
if (stat(path, &st) == 0 && !S_ISDIR(st.st_mode)) { |
235 |
> |
if (!is_dir) { |
236 |
|
int path_len = strlen(path); |
237 |
|
for (int i=0; e2t_translation[i].ext; i++) { |
238 |
|
int ext_len = strlen(e2t_translation[i].ext); |
247 |
|
} |
248 |
|
} |
249 |
|
|
250 |
< |
void set_finfo(const char *path, uint32 finfo, uint32 fxinfo) |
250 |
> |
void set_finfo(const char *path, uint32 finfo, uint32 fxinfo, bool is_dir) |
251 |
|
{ |
252 |
|
// Open Finder info file |
253 |
|
int fd = open_finf(path, O_RDWR); |