MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / getDefaultPanel

Method getDefaultPanel

Source/Native/CtrlrLinux.cpp:124–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124const Result CtrlrLinux::getDefaultPanel(MemoryBlock& dataToWrite)
125{
126#ifdef DEBUG_INSTANCE
127 File temp("/home/r.kubiak/devel/debug.bpanelz");
128 temp.loadFileAsData (dataToWrite);
129 return (Result::ok());
130#endif
131 libr_file *handle = libr_open (nullptr, LIBR_READ);
132
133 if (handle == nullptr)
134 {
135 return (Result::fail ("Linux native, libr_open failed to open binary [self]"));
136 }
137 else
138 {
139 _DBG("CtrlrLinux::getDefaultPanel, libr_open succeeded for binary [self]");
140 }
141
142 size_t panelDataSize;
143 char *panelData = (char *)libr_malloc (handle, (char *)CTRLR_INTERNAL_PANEL_SECTION, &panelDataSize);
144
145 if (panelData == nullptr)
146 {
147 libr_close (handle);
148 return (Result::fail ("Linux native, libr_malloc didn't fint embedded panel in binary"));
149 }
150 else
151 {
152 _DBG("CtrlrLinux::getDefaultPanel, libr_malloc returned data for panel size ["+STR((int32)panelDataSize)+"]");
153 }
154
155 dataToWrite.append (panelData, panelDataSize);
156
157 libr_close (handle);
158
159 return (Result::ok());
160}
161
162const Result CtrlrLinux::getDefaultResources(MemoryBlock& dataToWrite)
163{

Callers

nothing calls this directly

Calls 5

libr_openFunction · 0.85
libr_mallocFunction · 0.85
libr_closeFunction · 0.85
loadFileAsDataMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected