Commits

Ville Suoranta authored cc0ee8e5d14 Merge
Merge pull request #1037 in CASA/casa from CAS-12554 to master

* commit '4eab7ba3b8740d2386ec789eac350564c5073d15': changes for plotms w/grpc

code/plotms/apps/casaplotms/casaplotms.cc

Modified
171 171 ARG_DEBUG2 = "--debug",
172 172 ARG_NOPOPUPS = "--nopopups",
173 173 ARG_SHOWGUI = "--nogui";
174 174
175 175 //
176 176 // configure datapath for casacore and colormaps...
177 177 //
178 178 auto ends_with = []( const std::string& str, const std::string& ending ) {
179 179 return ( str.size( ) >= ending.size( ) ) && equal( ending.rbegin( ), ending.rend( ), str.rbegin( ) );
180 180 };
181 + auto begins_with = []( const std::string& str, const std::string& beginning ) {
182 + return str.size( ) >= beginning.size( ) && str.substr(0, beginning.size( )) == beginning;
183 + };
181 184
182 185 if ( ends_with(exepath, "Contents/MacOS/CASAplotms") ||
183 186 ends_with(exepath, "Contents/MacOS/casaplotms") ) {
184 187 // initialize CASAviewer app data...
185 188 if ( ! casacore::AppStateSource::fetch( ).initialized( ) ) {
186 189 // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
187 190 // Mac OSX -- path is specific to package format
188 191 // - - - - - - - - - - - - - - - - - - - - - - - - -
189 192 // initialize CASAviewer app data...
190 193 // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
197 200 std::list<std::string> datadirs;
198 201 datadirs.push_back(datapath);
199 202 casacore::AppStateSource::initialize(new PlotmsDataState(datadirs));
200 203 // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
201 204 // set up Qt Plugin Path
202 205 // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
203 206 pluginpath += "Plugins";
204 207 QCoreApplication::addLibraryPath(QString(pluginpath.c_str( )));
205 208 }
206 209
207 - } else if ( ends_with(exepath, "/AppRun") ||
208 - ends_with(exepath, "/CASAplotms.app/usr/bin/CASAplotms") ||
209 - ends_with(exepath, "/casaplotms.app/usr/bin/casaplotms") ) {
210 + } else if ( begins_with(exepath,"/tmp/.mount") && ends_with(exepath,"/usr/bin/casaplotms") ||
211 + ends_with(exepath,"/casaplotms.app/usr/bin/casaplotms") ) {
210 212
211 213 // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
212 214 // linux -- path is specific to package format
213 215 //
214 216 // .../AppRun implies AppImage bash script startup, e.g. from an unpacked AppImage
215 217 // .../CASAplotms.app/usr/bin/CASAplotms implies debugging or running from the
216 218 // build tree before it has been packaged
217 219 //
218 220 // - - - - - - - - - - - - - - - - - - - - - - - - -
219 221 // initialize CASAplotms app data...
220 222 // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
221 223 // generate path to data...
222 - bool packed_app = ends_with(exepath, "/AppRun");
223 224 std::string datapath(exepath);
224 - // packed_app -> .../AppRun
225 - // not packed_app -> .../CASAplotms.app/usr/bin/CASAplotms
226 - datapath.erase( datapath.end( ) - (packed_app ? 6 : 18), datapath.end( ) );
225 + // .../usr/bin/casaplotms
226 + // 123456789012345678
227 + // 1
228 + datapath.erase( datapath.end( ) - 18, datapath.end( ) );
227 229 std::string pluginpath = datapath; // save for later...
228 230 datapath += "data";
229 231 // initialize casacore...
230 232 std::list<std::string> datadirs;
231 233 datadirs.push_back(datapath);
232 234 casacore::AppStateSource::initialize(new PlotmsDataState(datadirs));
233 235 // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
234 236 // set up Qt Plugin Path
235 237 // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
236 238 pluginpath += "usr/lib/plugins";

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut