Browse Source

change paths from absolute to relative for all Targets but pi

master
das 5 years ago
committed by Krisjanis Rijnieks
parent
commit
33fc850aaf
  1. 8
      src/Application/SettingsLoader.cpp
  2. 34
      src/MediaServer/MediaServer.cpp
  3. 1
      src/ofxPiMapper.cpp

8
src/Application/SettingsLoader.cpp

@ -78,10 +78,16 @@ bool SettingsLoader::load(
source = mediaServer.loadMedia(sourceName, typeEnum); source = mediaServer.loadMedia(sourceName, typeEnum);
}else{ }else{
// relative pathss as default, absolute Paths for RASPI
bool absolutePathSwitch = false;
#ifdef TARGET_RASPBERRY_PI
absolutePathSwitch = true;
#endif
// Construct full path // Construct full path
std::string dir = mediaServer.getDefaultMediaDir(typeEnum); std::string dir = mediaServer.getDefaultMediaDir(typeEnum);
std::stringstream pathss; std::stringstream pathss;
pathss << ofToDataPath(dir, true) << sourceName; pathss << ofToDataPath(dir, absolutePathSwitch) << sourceName;
std::string sourcePath = pathss.str(); std::string sourcePath = pathss.str();
// Check if file exists // Check if file exists

34
src/MediaServer/MediaServer.cpp

@ -1,21 +1,29 @@
#include "MediaServer.h" #include "MediaServer.h"
namespace ofx { namespace ofx {
namespace piMapper { namespace piMapper {
MediaServer::MediaServer(): // relative pathss as default, absolute Paths for RASPI
piVideoWatcher(PI_IMAGES_DIR, SourceType::SOURCE_TYPE_VIDEO), bool absolutePathSwitch = false;
usb0VideoWatcher(USB0_VIDEOS_DIR, SourceType::SOURCE_TYPE_VIDEO), #ifdef TARGET_RASPBERRY_PI
usb1VideoWatcher(USB1_VIDEOS_DIR, SourceType::SOURCE_TYPE_VIDEO), absolutePathSwitch = true;
usb2VideoWatcher(USB2_VIDEOS_DIR, SourceType::SOURCE_TYPE_VIDEO), #endif
usb3VideoWatcher(USB3_VIDEOS_DIR, SourceType::SOURCE_TYPE_VIDEO), MediaServer::MediaServer() :
piImageWatcher(PI_IMAGES_DIR, SourceType::SOURCE_TYPE_IMAGE), piVideoWatcher(PI_IMAGES_DIR, SourceType::SOURCE_TYPE_VIDEO),
usb0ImageWatcher(USB0_IMAGES_DIR, SourceType::SOURCE_TYPE_IMAGE), usb0VideoWatcher(USB0_VIDEOS_DIR, SourceType::SOURCE_TYPE_VIDEO),
usb1ImageWatcher(USB1_IMAGES_DIR, SourceType::SOURCE_TYPE_IMAGE), usb1VideoWatcher(USB1_VIDEOS_DIR, SourceType::SOURCE_TYPE_VIDEO),
usb2ImageWatcher(USB2_IMAGES_DIR, SourceType::SOURCE_TYPE_IMAGE), usb2VideoWatcher(USB2_VIDEOS_DIR, SourceType::SOURCE_TYPE_VIDEO),
usb3ImageWatcher(USB3_IMAGES_DIR, SourceType::SOURCE_TYPE_IMAGE), usb3VideoWatcher(USB3_VIDEOS_DIR, SourceType::SOURCE_TYPE_VIDEO),
imageWatcher(ofToDataPath(DEFAULT_IMAGES_DIR, true), SourceType::SOURCE_TYPE_IMAGE), piImageWatcher(PI_IMAGES_DIR, SourceType::SOURCE_TYPE_IMAGE),
videoWatcher(ofToDataPath(DEFAULT_VIDEOS_DIR, true), SourceType::SOURCE_TYPE_VIDEO) usb0ImageWatcher(USB0_IMAGES_DIR, SourceType::SOURCE_TYPE_IMAGE),
usb1ImageWatcher(USB1_IMAGES_DIR, SourceType::SOURCE_TYPE_IMAGE),
usb2ImageWatcher(USB2_IMAGES_DIR, SourceType::SOURCE_TYPE_IMAGE),
usb3ImageWatcher(USB3_IMAGES_DIR, SourceType::SOURCE_TYPE_IMAGE),
imageWatcher(ofToDataPath(DEFAULT_IMAGES_DIR, absolutePathSwitch), SourceType::SOURCE_TYPE_IMAGE),
videoWatcher(ofToDataPath(DEFAULT_VIDEOS_DIR, absolutePathSwitch), SourceType::SOURCE_TYPE_VIDEO)
{ {
// By initialising all above we also copy files from external media // By initialising all above we also copy files from external media
// to the ofxPiMapper storage. // to the ofxPiMapper storage.

1
src/ofxPiMapper.cpp

@ -1,5 +1,6 @@
#include "ofxPiMapper.h" #include "ofxPiMapper.h"
ofxPiMapper::ofxPiMapper(){} ofxPiMapper::ofxPiMapper(){}
void ofxPiMapper::setup(){ void ofxPiMapper::setup(){

Loading…
Cancel
Save