···11+/*
22+This file is part of Darling.
33+44+Copyright (C) 2020 Lubos Dolezel
55+66+Darling is free software: you can redistribute it and/or modify
77+it under the terms of the GNU General Public License as published by
88+the Free Software Foundation, either version 3 of the License, or
99+(at your option) any later version.
1010+1111+Darling is distributed in the hope that it will be useful,
1212+but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+GNU General Public License for more details.
1515+1616+You should have received a copy of the GNU General Public License
1717+along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+#include <CoreServices/Files.h>
2020+#include <CoreServices/MacErrors.h>
2121+2222+OSErr FSGetDataForkName(HFSUniStr255* dataForkName)
2323+{
2424+ dataForkName->length = 0;
2525+ return noErr;
2626+}
2727+2828+OSErr FSGetResourceForkName(HFSUniStr255* rsrcForkName)
2929+{
3030+ const char name[] = "RESOURCE_FORK";
3131+ rsrcForkName->length = sizeof(name) - 1;
3232+3333+ for (int i = 0; i < sizeof(name) - 1; i++)
3434+ rsrcForkName->unicode[i] = name[i];
3535+3636+ return noErr;
3737+}
···11+/*
22+This file is part of Darling.
33+44+Copyright (C) 2020 Lubos Dolezel
55+66+Darling is free software: you can redistribute it and/or modify
77+it under the terms of the GNU General Public License as published by
88+the Free Software Foundation, either version 3 of the License, or
99+(at your option) any later version.
1010+1111+Darling is distributed in the hope that it will be useful,
1212+but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+GNU General Public License for more details.
1515+1616+You should have received a copy of the GNU General Public License
1717+along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+#include "ResourcesImpl.h"
2020+#include <stdexcept>
2121+2222+// File format documentation:
2323+// https://developer.apple.com/library/archive/documentation/mac/MoreToolbox/MoreToolbox-99.html
2424+2525+Resources::Resources(const char* file, bool readOnly, bool resourceFork)
2626+: m_file(file), m_readOnly(readOnly), m_resourceFork(resourceFork)
2727+{
2828+2929+}
+36
src/frameworks/CoreServices/ResourcesImpl.h
···11+/*
22+This file is part of Darling.
33+44+Copyright (C) 2020 Lubos Dolezel
55+66+Darling is free software: you can redistribute it and/or modify
77+it under the terms of the GNU General Public License as published by
88+the Free Software Foundation, either version 3 of the License, or
99+(at your option) any later version.
1010+1111+Darling is distributed in the hope that it will be useful,
1212+but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+GNU General Public License for more details.
1515+1616+You should have received a copy of the GNU General Public License
1717+along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+2020+#ifndef _CS_RESOURCES_IMPL_H
2121+#define _CS_RESOURCES_IMPL_H
2222+#include <CoreServices/Resources.h>
2323+#include <string>
2424+2525+class Resources
2626+{
2727+public:
2828+2929+ Resources(const char* file, bool readOnly, bool resourceFork);
3030+private:
3131+ std::string m_file;
3232+ const bool m_readOnly, m_resourceFork;
3333+};
3434+3535+#endif
3636+