wdc-utils/set_file_type.cpp

20 lines
342 B
C++
Raw Normal View History

2017-01-11 19:05:12 +00:00
#include <string>
#include <stdint.h>
2017-01-23 15:02:50 +00:00
#include "finder_info_helper.h"
2017-01-11 19:05:12 +00:00
2017-01-11 19:28:18 +00:00
int set_file_type(const std::string &path, uint16_t file_type, uint32_t aux_type) {
2017-01-11 19:05:12 +00:00
2017-01-23 15:02:50 +00:00
finder_info_helper fi;
2017-01-11 19:05:12 +00:00
2017-01-23 15:02:50 +00:00
bool ok;
ok = fi.open(path, false);
if (!ok) return -1;
fi.set_prodos_file_type(file_type, aux_type);
ok = fi.write();
if (!ok) return -1;
return 0;
2017-01-11 19:05:12 +00:00
}