since windows is too dumb to have a top-level root folder, we need to rely on the virtualization environment that is getting us the features we rely on, which usually come from unix (or linux). the toolsets used in the past for this include MSYS, Cygwin, and possibly others. this release is starting to support Cygwin and others will be added as time permits.
const astring &application_configuration::LOGGING_FOLDER_NAME() { STATIC_STRING("LogPath"); }
+const astring &application_configuration::WINDOZE_VIRTUAL_ROOT_NAME()
+{ STATIC_STRING("VirtualUnixRoot"); }
+
+const astring &application_configuration::DEFAULT_VIRTUAL_UNIX_ROOT()
+{ STATIC_STRING("c:/cygwin"); }
+
+//////////////
+
+astring application_configuration::get_virtual_unix_root()
+{
+#ifdef __UNIX__
+ // simple implementation for unix/linux; just tell the truth about the real root.
+ return "/";
+#endif
+#ifdef __WIN32__
+ /*
+ read the path out of the config file, which should have been set during the
+ build process if this is really windows.
+ */
+ astring virtual_root = read_item(WINDOZE_VIRTUAL_ROOT_NAME());
+ if (!virtual_root) {
+ // if it has no length, we didn't get our setting! we'll limp along with a guess.
+ return DEFAULT_VIRTUAL_UNIX_ROOT;
+ }
+
+#endif
+}
+
//////////////
////const int MAX_LOG_PATH = 512;
//!< retrieves the core binary directory location from paths.ini.
static basis::astring get_logging_directory();
- //!< returns the directory where log files will be stored.
+ //!< returns the folder where the log files for the feisty meow system are stored.
+ /*!< any log files should be written to this folder by the rest of the codebase,
+ unless there are special purposes for those log files. but logs from general
+ operation of feisty meow should be written in this directory. */
+
+ static basis::astring get_virtual_unix_root();
+ //!< returns the path to the unix root, which may be simulated.
+ /*!< on unix, this will just return '/'. on win32 with cygwin installed,
+ this will return the cygwin path for '/' that was detected at build time.
+ this is often "c:/cygwin", which we use as a default if the path isn't
+ detected properly. */
// the following are key names within the main configuration file.
+ // not generally for external use.
static const basis::astring &GLOBAL_SECTION_NAME();
//!< the root section name for our configuration items in the main ini file.
/*!< this is where all files for this product are stored on "this" machine. */
static const basis::astring &LOGGING_FOLDER_NAME();
- //!< the location where the log files for the system are stored.
- /*!< this is always considered to be a directory under the local folder.
- the make_logfile_name() function (see below) can be used to create a
- properly formed filename for logging. */
+ //!< the tag used for finding our logging path in the paths config file.
+
+ static const basis::astring &WINDOZE_VIRTUAL_ROOT_NAME();
+ //!< the tag used for looking up the virtual windows path in the paths config file.
+
+ static const basis::astring &DEFAULT_VIRTUAL_UNIX_ROOT();
+ //!< default value if we don't find our setting for virtual root.
+ /*!< this is bound to fail on many occasions if it's actually used on
+ windoze for the default, but if we don't have good information ready,
+ we can't just intuit the virtual unix root; we are not kreskin. the
+ virtual unix environment could be MSYS, Cygwin, or others. Currently,
+ if Cygwin is used during the build process, then the default should
+ never be needed. support for other systems will be added as time
+ permits and users clamor for them. */
// helper methods.
//LOG(astring("turned msys string into: ") + *this);
}
}
+
+ // if no specialized path specifications were seen, and we have a unix style path
+ // here, then there will be trouble when we pass that to windows.
+//if first character is a slash, and second char is alphanumeric, then we check...
+//can we find a cygwin root dir stored in our config stuff?
+// maybe in the build version file? ugh, yuck.
+// what about in generated files, created at build time? --> yes, nice option.
+//
+//hmmm: we need the capability to re-create the config file that tells us
+// where cyg root is, but how can we, aside from guessing at where to find
+// cygwin (c:/cygwin c:/cygwin64 etc).
+//
+//hmmm:
+
#endif
// we don't crop the last separator if the name's too small. for msdos
[Common]
+# default logging path that users can alter if needed.
LogPath=$FEISTY_MEOW_GENERATED_STORE/logs
+# default location of virtual root directory for Unix.
+# replaced at runtime on windoze if cygwin is available.
+#hmmm: support msys too at some point? very worthy as well.
+VirtualUnixRoot=c:/cygwin
[Common]
+# simple cgi paths.ini to point at different logging when really running.
+#hmmm: not sure this is still useful or necessary; is it being honored on running systems with feisty?
LogPath=/tmp/cgi-bin-logs
export BUILD_SCRIPTS_PATH="$( \cd "$(\dirname "$0")" && /bin/pwd )"
#echo build scripts dir initial value: $BUILD_SCRIPTS_PATH
BUILD_SCRIPTS_PATH="$(echo $BUILD_SCRIPTS_PATH | tr '\\\\' '/' )"
+#hmmm: why four backslashes above? trying two in our unix virtual root code below.
#echo build scripts dir after chewing: $BUILD_SCRIPTS_PATH
# load in feisty meow basic scripts, if not already loaded.
mkdir -p "$CLAM_BINARIES"
fi
if [ ! -f "$CLAM_BINARIES/paths.ini" ]; then
- echo "copied paths.ini to binary dir."
cp "$PRODUCTION_STORE/paths.ini" "$CLAM_BINARIES"
+ echo "copied paths.ini to binary dir."
+ fi
+ # set the cygwin root path if we're on cygwin.
+ whichable cygpath
+ if [ $? -eq 0 ]; then
+ # found cygpath, so run it now to get the dossy path of the root ('/' folder).
+ found_root=$(cygpath -w -m /)
+ if [ $? -ne 0 ]; then
+ echo "Failure to find virtual Unix root folder with cygpath."
+ exit 1322
+ fi
+echo "found root as '$found_root'"
+ # translate any backslashes to forward thinking slashes.
+ found_root=$(echo $found_root | tr '\\' '/')
+echo "processed root is now: '$found_root'"
+ # edit the entry in place to correct the default path.
+ sed -i -e "s/VirtualUnixRoot=.*/VirtualUnixRoot=$found_root/" "$CLAM_BINARIES/paths.ini"
+echo "paths file now has:"
+cat "$CLAM_BINARIES/paths.ini"
fi
}