FireBirdLib - Topfield TMS PVR TAP Programming Library
HDD_ChangeDir.c
Go to the documentation of this file.
1#include <string.h>
2#include "FBLib_hdd.h"
3#include "libFireBird.h"
4
5bool HDD_ChangeDir(const char *Dir)
6{
8
9 char s[FBLIB_DIR_SIZE], TAPDir[FBLIB_DIR_SIZE], DirUTF8[FBLIB_DIR_SIZE];
10 static bool ReturnTypeToBeChecked = TRUE;
11 static int ChDirSuccessful = 0;
12
13 //The TMS supports absolute paths.
14
15 //Starting with 2009-08-13 (SysID 22010, version 0105), TF changed the return value
16 // of TAP_Hdd_ChangeDir() to the same type as the current TF5000 API
17 //Get a good return value by changing to a well known directory
18 if(ReturnTypeToBeChecked)
19 {
21 ChDirSuccessful = TAP_Hdd_ChangeDir("/ProgramFiles");
22 ReturnTypeToBeChecked = FALSE;
24 }
25
26 if(Dir && *Dir)
27 {
28 strcpy(s, Dir);
29 if(s[strlen(s) - 1] != '/') strcat(s, "/");
31 if(!*TAPDir)
32 {
33 TRACEEXIT();
34 return FALSE;
35 }
36
37 if(TAP_Hdd_ChangeDir(TAPDir) == ChDirSuccessful)
38 {
39 TRACEEXIT();
40 return TRUE;
41 }
42
43 //On some versions, TAP_Hdd_ChangeDir() fails to change into directories with German Umlaute. Try it in UTF-8 format instead.
44 if(isUTFToppy())
45 {
46 StrToUTF8(TAPDir, DirUTF8, 9);
47 if(TAP_Hdd_ChangeDir(DirUTF8) == ChDirSuccessful)
48 {
49 TRACEEXIT();
50 return TRUE;
51 }
52 }
53 }
54
55 TRACEEXIT();
56 return FALSE;
57}
void ConvertPathType(const char *Source, char *Dest, tPathFormat DestFormat)
bool HDD_ChangeDir(const char *Dir)
Definition: HDD_ChangeDir.c:5
bool isUTFToppy(void)
Definition: isUTFToppy.c:3
bool HDD_TAP_PushDir(void)
#define FBLIB_DIR_SIZE
Definition: libFireBird.h:1871
#define TRACEEXIT()
Definition: libFireBird.h:1244
bool StrToUTF8(const byte *SourceString, byte *DestString, byte DefaultISO8859CharSet)
Definition: StrToUTF8.c:146
#define TRACEENTER()
Definition: libFireBird.h:1243
bool HDD_TAP_PopDir(void)
Definition: HDD_TAP_PopDir.c:3
@ PF_TAPPathOnly
Definition: libFireBird.h:1923