mirror of
https://github.com/autc04/Retro68.git
synced 2026-04-24 13:17:08 +00:00
Switch tab-indented files to 4-space indent
This commit is contained in:
@@ -11,43 +11,43 @@ namespace fs = boost::filesystem;
|
||||
|
||||
void MakeExecutable(string fn)
|
||||
{
|
||||
ResourceFile rsrcFile(fn);
|
||||
if(!rsrcFile.read())
|
||||
{
|
||||
std::cerr << "Cannot read application file: " << fn << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
if(!rsrcFile.hasPlainDataFork())
|
||||
{
|
||||
std::cerr << "--make-executable can not be used with this data format.\n";
|
||||
exit(1);
|
||||
}
|
||||
ResourceFile rsrcFile(fn);
|
||||
if(!rsrcFile.read())
|
||||
{
|
||||
std::cerr << "Cannot read application file: " << fn << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
if(!rsrcFile.hasPlainDataFork())
|
||||
{
|
||||
std::cerr << "--make-executable can not be used with this data format.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
string headerString = "#!" RETRO68_PREFIX "/bin/LaunchAPPL\n";
|
||||
string headerString = "#!" RETRO68_PREFIX "/bin/LaunchAPPL\n";
|
||||
|
||||
bool hadShebang = false;
|
||||
if(rsrcFile.data.size())
|
||||
{
|
||||
if(headerString.substr(2) == "#!")
|
||||
{
|
||||
string::size_type eol = headerString.find('\n');
|
||||
if(eol != string::npos && eol >= 13 && eol < 4096)
|
||||
{
|
||||
if(headerString.substr(eol-11,11) == "/LaunchAPPL")
|
||||
hadShebang = true;
|
||||
}
|
||||
}
|
||||
bool hadShebang = false;
|
||||
if(rsrcFile.data.size())
|
||||
{
|
||||
if(headerString.substr(2) == "#!")
|
||||
{
|
||||
string::size_type eol = headerString.find('\n');
|
||||
if(eol != string::npos && eol >= 13 && eol < 4096)
|
||||
{
|
||||
if(headerString.substr(eol-11,11) == "/LaunchAPPL")
|
||||
hadShebang = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!hadShebang)
|
||||
{
|
||||
std::cerr << "Unfortunately, the application already has a data fork.\n";
|
||||
std::cerr << "LaunchAPPL --make-executable does not currently work for PowerPC apps.\n";
|
||||
// TODO: if it's a PEF container, move it back a little and update cfrg
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if(!hadShebang)
|
||||
{
|
||||
std::cerr << "Unfortunately, the application already has a data fork.\n";
|
||||
std::cerr << "LaunchAPPL --make-executable does not currently work for PowerPC apps.\n";
|
||||
// TODO: if it's a PEF container, move it back a little and update cfrg
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
std::fstream(fn, std::ios::in | std::ios::out | std::ios::binary) << headerString;
|
||||
std::fstream(fn, std::ios::in | std::ios::out | std::ios::binary) << headerString;
|
||||
|
||||
fs::permissions(fs::path(fn), fs::owner_exe | fs::group_exe | fs::others_exe | fs::add_perms);
|
||||
fs::permissions(fs::path(fn), fs::owner_exe | fs::group_exe | fs::others_exe | fs::add_perms);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user