In OS/2 change current drive before changing current directory.

This commit is contained in:
2021-04-05 21:51:56 +01:00
parent 7c8582bde4
commit 7626ea03f8
9 changed files with 127 additions and 0 deletions

View File

@@ -45,6 +45,17 @@ void ExtendedAttributes(const char* path)
HFILE handle;
char message[300];
EAOP eap;
USHORT driveNo = path[0] - '@';
if(driveNo > 32) driveNo -= 32;
rc = DosSelectDisk(driveNo);
if(rc)
{
log_write("Cannot change to specified drive, not continuing.\n");
return;
}
drivePath[0] = path[0];
drivePath[1] = ':';

View File

@@ -47,6 +47,23 @@ void FileAttributes(const char* path)
FILESTATUS3 fileStatus = {{0}};
#endif
// 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT driveNo = path[0] - '@';
#else // 32 bit
ULONG driveNo = path[0] - '@';
#endif
if(driveNo > 32) driveNo -= 32;
rc = __os2_chdisk(driveNo);
if(rc)
{
log_write("Cannot change to specified drive, not continuing.\n");
return;
}
drivePath[0] = path[0];
drivePath[1] = ':';
drivePath[2] = '\\';

View File

@@ -44,6 +44,23 @@ void DeleteFiles(const char* path)
ACTION_RET actionTaken = 0;
HFILE handle;
// 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT driveNo = path[0] - '@';
#else // 32 bit
ULONG driveNo = path[0] - '@';
#endif
if(driveNo > 32) driveNo -= 32;
rc = __os2_chdisk(driveNo);
if(rc)
{
log_write("Cannot change to specified drive, not continuing.\n");
return;
}
drivePath[0] = path[0];
drivePath[1] = ':';
drivePath[2] = '\\';

View File

@@ -42,6 +42,23 @@ void DirectoryDepth(const char* path)
char filename[9];
int pos = 2;
// 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT driveNo = path[0] - '@';
#else // 32 bit
ULONG driveNo = path[0] - '@';
#endif
if(driveNo > 32) driveNo -= 32;
rc = __os2_chdisk(driveNo);
if(rc)
{
log_write("Cannot change to specified drive, not continuing.\n");
return;
}
drivePath[0] = path[0];
drivePath[1] = ':';
drivePath[2] = '\\';

View File

@@ -44,6 +44,23 @@ void Filenames(const char* path)
char message[300];
int pos = 0;
// 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT driveNo = path[0] - '@';
#else // 32 bit
ULONG driveNo = path[0] - '@';
#endif
if(driveNo > 32) driveNo -= 32;
rc = __os2_chdisk(driveNo);
if(rc)
{
log_write("Cannot change to specified drive, not continuing.\n");
return;
}
drivePath[0] = path[0];
drivePath[1] = ':';
drivePath[2] = '\\';

View File

@@ -44,6 +44,23 @@ void MillionFiles(const char* path)
ACTION_RET actionTaken = 0;
HFILE handle;
// 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT driveNo = path[0] - '@';
#else // 32 bit
ULONG driveNo = path[0] - '@';
#endif
if(driveNo > 32) driveNo -= 32;
rc = __os2_chdisk(driveNo);
if(rc)
{
log_write("Cannot change to specified drive, not continuing.\n");
return;
}
drivePath[0] = path[0];
drivePath[1] = ':';
drivePath[2] = '\\';

View File

@@ -49,6 +49,23 @@ void Fragmentation(const char* path, size_t clusterSize)
HFILE handle;
long i;
// 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT driveNo = path[0] - '@';
#else // 32 bit
ULONG driveNo = path[0] - '@';
#endif
if(driveNo > 32) driveNo -= 32;
rc = __os2_chdisk(driveNo);
if(rc)
{
log_write("Cannot change to specified drive, not continuing.\n");
return;
}
drivePath[0] = path[0];
drivePath[1] = ':';
drivePath[2] = '\\';

View File

@@ -76,12 +76,14 @@ Copyright (C) 2011-2021 Natalia Portillo
#define __os2_chdir(path) DosChDir(path, 0)
#define __os2_mkdir(path) DosMkDir(path, 0)
#define __os2_delete(path) DosDelete(path, 0)
#define __os2_chdisk(driveNumber) DosSelectDisk(driveNumber)
#else // 32 bit
#define __os2_chdir(path) DosSetCurrentDir(path)
#define __os2_mkdir(path) DosCreateDir(path, NULL)
#define __os2_delete(path) DosDelete(path)
#define __os2_chdisk(driveNumber) DosSetDefaultDisk(driveNumber)
#endif

View File

@@ -49,11 +49,23 @@ void Timestamps(const char* path)
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT status_size = sizeof(FILESTATUS);
FILESTATUS status;
USHORT driveNo = path[0] - '@';
#else // 32 bit
ULONG status_size = sizeof(FILESTATUS3);
FILESTATUS3 status;
ULONG driveNo = path[0] - '@';
#endif
if(driveNo > 32) driveNo -= 32;
rc = __os2_chdisk(driveNo);
if(rc)
{
log_write("Cannot change to specified drive, not continuing.\n");
return;
}
drivePath[0] = path[0];
drivePath[1] = ':';
drivePath[2] = '\\';