| 160 | } |
| 161 | |
| 162 | const Result CtrlrLinux::getDefaultResources(MemoryBlock& dataToWrite) |
| 163 | { |
| 164 | #ifdef DEBUG_INSTANCE |
| 165 | File temp("/home/r.kubiak/devel/debug.bpanelz"); |
| 166 | MemoryBlock data; |
| 167 | { |
| 168 | ScopedPointer <FileInputStream> fis (temp.createInputStream()); |
| 169 | fis->readIntoMemoryBlock (data); |
| 170 | } |
| 171 | |
| 172 | ValueTree t = ValueTree::readFromGZIPData(data.getData(), data.getSize()); |
| 173 | |
| 174 | if (t.isValid()) |
| 175 | { |
| 176 | ValueTree r = t.getChildWithName (Ids::resourceExportList); |
| 177 | if (r.isValid()) |
| 178 | { |
| 179 | MemoryOutputStream mos (dataToWrite, false); |
| 180 | { |
| 181 | GZIPCompressorOutputStream gzipOutputStream (&mos); |
| 182 | r.writeToStream(gzipOutputStream); |
| 183 | gzipOutputStream.flush(); |
| 184 | } |
| 185 | return (Result::ok()); |
| 186 | } |
| 187 | } |
| 188 | else |
| 189 | { |
| 190 | return (Result::fail("Linux Native: getDefaultResources got data but couldn't parse it as a compressed ValueTree")); |
| 191 | } |
| 192 | #endif |
| 193 | |
| 194 | libr_file *handle = libr_open (nullptr, LIBR_READ); |
| 195 | |
| 196 | if (handle == nullptr) |
| 197 | { |
| 198 | return (Result::fail ("Linux native, libr_open failed to open binary [self]")); |
| 199 | } |
| 200 | else |
| 201 | { |
| 202 | _DBG("CtrlrLinux::getDefaultResources, libr_open succeeded for binary [self]"); |
| 203 | } |
| 204 | |
| 205 | size_t panelResourcesDataSize; |
| 206 | char *panelResourcesData = (char *)libr_malloc (handle, (char *)CTRLR_INTERNAL_RESOURCES_SECTION, &panelResourcesDataSize); |
| 207 | |
| 208 | if (panelResourcesData == nullptr) |
| 209 | { |
| 210 | libr_close (handle); |
| 211 | return (Result::fail ("Linux native, libr_malloc didn't find embedded panel resources in binary")); |
| 212 | } |
| 213 | else |
| 214 | { |
| 215 | _DBG("CtrlrLinux::getDefaultResources, libr_malloc returned data for panel size ["+STR((int32)panelResourcesDataSize)+"]"); |
| 216 | } |
| 217 | |
| 218 | dataToWrite.append (panelResourcesData, panelResourcesDataSize); |
| 219 |
nothing calls this directly
no test coverage detected