Skip to content

Commit

Permalink
Some successful tinkering for pathnames re issue #110.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahlstromcj committed May 10, 2023
1 parent a890aaa commit cfd8420
Show file tree
Hide file tree
Showing 14 changed files with 581 additions and 487 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# README for Seq66 0.99.4 2023-05-08
# README for Seq66 0.99.4 2023-05-10

__Seq66__: MIDI sequencer and live-looper with a hardware-sampler grid
interface, pattern sets/banks, pattern triggers, and playlists for song
Expand Down Expand Up @@ -95,8 +95,11 @@ Windows, and using a conventional source tarball.
* Eliminated "missing ctrl" message at first startup.
* Fixed port ID setting in midibus, and adding output flag in
midi_alsa_info.
* Windows: Added scripting to build NSIS-based install without
leaving Windows.
* Issue #110 Windows: Fixed compiler errors and added scripting to
build NSIS-based install without leaving Windows, if desired.
* Internal refactoring to regularize handling of the session/config
directory between Linux and Windows.
* Rearranged the Seq66 man pages more sensibly.
* Version 0.99.4:
* Issue #3: The scroll wheel is enabled in the piano rolls (only).
* Issue #48: For a new NSM session configuration, disable "JACK"
Expand Down
5 changes: 4 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TO DO for Seq66 0.99.5 (Sequencer64 refactored for C++14 and Qt)
Chris Ahlstrom
2019-04-13 to 2023-05-08
2019-04-13 to 2023-05-09

Some of these issues will be pushed off for the distant Seq66v2.

Expand All @@ -17,6 +17,9 @@ Hot:
- Replace I and O map checkboxes with just one checkbox.
- Finish the major upgrade to the event editor; plan for a
"SeqSpec" tab? Worth it?
- Naming an NSM session puzz yields:
[seq66] Session path: '/home/ahlstrom/.local/share/nsm/puzz/seq66.nAYMS'
Correct?

UI:

Expand Down
7 changes: 6 additions & 1 deletion contrib/git/git.text
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Quick Reference for Git Processes on GitHub
Chris Ahlstrom
2015-09-09 to 2023-05-07
2015-09-09 to 2023-05-10

Creating a GitHub Repository:

Expand Down Expand Up @@ -248,6 +248,11 @@ Release:
- Update the README.md and RELNOTES (see below) files.
- Verify the master branch builds ("./bootstrap -er" followed
by "make") and runs.
- Update the files in the "nsis" directory to the latest version,
and update the readmes and license files as necessary.
- Verify that the Windows version builds, runs, and that the
Windows installer is created and works. Verify the configuration
files in C:/Users/user/AppData/Local/seq66. Update the
- Go to "doc/latex" and run "make" to rebuild the PDF manual.
- Run "git2cl > cl.txt" and use it to update the Changelog file.
- Commit this release build *without* the "-m" option. Instead,
Expand Down
28 changes: 24 additions & 4 deletions doc/latex/tex/sessions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
% \library Documents
% \author Chris Ahlstrom
% \date 2020-10-03
% \update 2023-05-03
% \update 2023-05-10
% \version $Revision$
% \license $XPC_GPL_LICENSE$
%
Expand Down Expand Up @@ -431,7 +431,7 @@ \subsubsection{Seq66 Session Management / NSM / Run in NSM}
+-- session.nsm
\end{verbatim}

Important: If one is running a recent "New" version of the
\textbf{Important}: If one is running a recent "New" version of the
\textsl{Non Session Manager}, then the session data is not stored
in \texttt{/home/user/NSM Sessions},
but in
Expand Down Expand Up @@ -576,9 +576,23 @@ \subsubsection{Session Management / Sessions Tab}
\begin{itemize}
\item Name of the session manager.
\item Session path for the session, the root directory of the session.
All data goes into this directory. If not running in a session,
All data goes into this directory.
The name of the directory is of the form
\texttt{HOME/NSMROOT/SESSIONNAME/UNIQUEID}.
HOME is the usual UNIX home directory for the user.
NSMROOT depends on which version of the New/NSM session manager is
used.
\index{session!non}
For the original NSM, this directory is \texttt{NSM Sessions}.
\index{session!new}
For the New Session Manager, this directory is
\texttt{.local/share/nsm}.
The session name is provided by the user when creating the
session.
The unique ID is generated by the NSM.
If not running in a session,
the active configuration directory (which can be modified via
command-line arguments) is shown.
the command-line argument \texttt{--home}) is shown.
\item The OSC URL of the session, which includes the port number.
Generally, the port number is selected at run-time, but it is also
possible to configure \textsl{NSM} to use a specific port number.
Expand Down Expand Up @@ -620,6 +634,12 @@ \subsubsection{Session Management / Sessions Tab}
can then be saved.
\end{itemize}

Note that there are many implementations of NSM clients:
\cite{agordejo},
\cite{raysession},
and the original
\cite{nsm} and the JACK project's \texttt{nsm-legacy-gui}.

\subsubsection{Seq66 Session Management / NSM / File Menu}
\label{subsubsec:sessions_file_menu}

Expand Down
10 changes: 8 additions & 2 deletions libseq66/include/cfg/rcsettings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,15 +325,21 @@ class rcsettings final : public basesettings
/**
* Holds the current 'rc' and 'usr' configuration base directory. This
* value is ".config/seq66" by default. For usage, it is normally
* expanded. For NSM usage, it is the path returned by the NSM daemon.
* expanded to a full path.
*
* For NSM usage, it is the full path returned by the NSM daemon.
*/

std::string m_session_directory;

/**
* An optional appendage to the base configuration directory.
* An optional appendage to the base configuration directory. It is
* appended to the default session/configuration path. It is set only
* by the --home option. The boolean makes sure the appending is done only
* once (due to processing command-line options multiple times, :-(.)
*/

mutable bool m_config_subdirectory_set;
std::string m_config_subdirectory;

/**
Expand Down
3 changes: 2 additions & 1 deletion libseq66/include/util/filefunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* \author Chris Ahlstrom
* \date 2015-11-20
* \updates 2023-05-09
* \updates 2023-05-10
* \version $Revision$
*
* Also see the filefunctions.cpp module. The functions here use
Expand Down Expand Up @@ -93,6 +93,7 @@ extern bool set_current_directory (const std::string & path);
extern std::string get_current_directory ();
extern std::string get_full_path (const std::string & path);
extern char path_slash ();
extern char os_path_slash ();
extern std::string os_normalize_path
(
const std::string & path,
Expand Down
50 changes: 30 additions & 20 deletions libseq66/src/cfg/rcsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* \library seq66 application
* \author Seq24 team; modifications by Chris Ahlstrom
* \date 2015-09-22
* \updates 2023-05-09
* \updates 2023-05-10
* \license GNU GPLv2 or above
*
* Note that this module also sets the legacy global variables, so that
Expand Down Expand Up @@ -110,6 +110,7 @@ rcsettings::rcsettings () :
m_jack_session_active (false),
m_last_used_dir (), /* double_quotes() */
m_session_directory (),
m_config_subdirectory_set (false),
m_config_subdirectory (),
m_config_filename (seq_config_name()), /* updated in body */
m_full_config_directory (),
Expand Down Expand Up @@ -205,6 +206,7 @@ rcsettings::set_defaults ()
m_jack_session_active = false;
m_last_used_dir.clear(); /* double_quotes() */
m_session_directory = user_session(seq_client_name());
m_config_subdirectory_set = false;
m_config_subdirectory.clear(),
m_config_filename = seq_config_name();
m_config_filename += ".rc";
Expand Down Expand Up @@ -443,18 +445,9 @@ rcsettings::default_session_path () const
else
{
if (name_has_root_path(session_directory()))
{
result = session_directory(); /* seq66 directory */
}
result = session_directory(); /* seq66 directory */
else
{
result += path_slash(); /* e.g. /home/username/ */
result += session_directory(); /* seq66 directory */

#if defined SEQ66_PLATFORM_UNIX /* TODO: make robust */
result += path_slash();
#endif
}
result = pathname_concatenate(result, session_directory());
}
return result;
}
Expand Down Expand Up @@ -485,7 +478,13 @@ rcsettings::home_config_directory () const
if (! home.empty())
{
if (! m_config_subdirectory.empty())
result = filename_concatenate(result, m_config_subdirectory);
{
if (! m_config_subdirectory_set)
{
result = filename_concatenate(result, m_config_subdirectory);
m_config_subdirectory_set = true;
}
}

bool ok = make_directory_path(result);
if (ok)
Expand Down Expand Up @@ -1051,19 +1050,20 @@ rcsettings::session_directory (const std::string & value)
/**
* \setter m_config_subdirectory
*
* This value is one of the ways to implement the --home option. It
* works if there is no root to the value parameter. It should only
* work once (when m_config_subdirectory has not yet been set).
*
* \param value
* The value to use to make the setting. This should be a relative path.
*/

void
rcsettings::config_subdirectory (const std::string & value)
{
if (! value.empty())
{
bool can_do = ! value.empty() && m_config_subdirectory.empty();
if (can_do)
m_config_subdirectory = value;

// Should we concatenate this to the current home directory?
}
}

/**
Expand Down Expand Up @@ -1101,13 +1101,23 @@ rcsettings::full_config_directory (const::std::string & value)
{
std::string tv = value;
if (! m_config_subdirectory.empty())
tv = pathname_concatenate(tv, m_config_subdirectory);

{
if (! m_config_subdirectory_set)
{
tv = pathname_concatenate(tv, m_config_subdirectory);
m_config_subdirectory_set = true;
}
}
m_full_config_directory = normalize_path(tv, true, true);

std::string homedir = rc().home_config_directory();
if (make_directory_path(homedir)) // REDUNDANT
{
/*
* This setting will convert the relative session directory
* to a full path.
*/

file_message("Config directory", homedir);
session_directory(homedir);
}
Expand Down
8 changes: 4 additions & 4 deletions libseq66/src/sessions/smanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2020-03-22
* \updates 2023-05-09
* \updates 2023-05-10
* \license GNU GPLv2 or above
*
* Note that this module is part of the libseq66 library, not the libsessions
Expand Down Expand Up @@ -1164,14 +1164,14 @@ smanager::make_path_names
const std::string & path,
std::string & outcfgpath,
std::string & outmidipath,
const std::string & midisubdir
const std::string & midisubdir // why no configsubdir (for NSM)?
)
{
bool result = ! path.empty();
if (result)
{
std::string cfgpath = path;
std::string midipath = path;
std::string cfgpath = normalize_path(path);
std::string midipath = cfgpath;
std::string subdir = midisubdir.empty() ? "midi" : midisubdir ;
midipath = pathname_concatenate(cfgpath, subdir);
outcfgpath = cfgpath;
Expand Down
Loading

0 comments on commit cfd8420

Please sign in to comment.