Browse Source

Nonlib: Add (some) support for opening sessions readonly.

tags/non-daw-v1.2.0
Jonathan Moore Liles 12 years ago
parent
commit
4f4698a12c
2 changed files with 16 additions and 1 deletions
  1. +13
    -1
      nonlib/Loggable.C
  2. +3
    -0
      nonlib/Loggable.H

+ 13
- 1
nonlib/Loggable.C View File

@@ -44,6 +44,7 @@ using std::max;


bool Loggable::_readonly = false;
FILE *Loggable::_fp;
unsigned int Loggable::_log_id = 0;
int Loggable::_level = 0;
@@ -116,8 +117,19 @@ Loggable::open ( const char *filename )
if ( ! ( fp = fopen( filename, "a+" ) ) )
{
WARNING( "Could not open log file for writing!" );
return false;
if ( ! ( fp = fopen( filename, "r" ) ) )
{
WARNING( "Could not open log file for reading!" );
return false;
}
else
{
_readonly = true;
}
}
_readonly = false;

load_unjournaled_state();



+ 3
- 0
nonlib/Loggable.H View File

@@ -70,6 +70,7 @@ class Loggable
Log_Entry * unjournaled_state;
};

static bool _readonly;
static FILE *_fp;
static unsigned int _log_id;
static int _level;
@@ -141,6 +142,8 @@ private:
static void clear_dirty ( void ) { signal_dirty( _dirty = 0 ); }

public:
static bool readonly ( void ) { return _readonly; }

static bool replay ( const char *name );



Loading…
Cancel
Save