Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

loadMacshapaDB

Jesse Lingeman edited this page Jul 20, 2012 · 1 revision

Purpose

Function for loading a MacSHAPA Closed database file into Ruby. This function is for loading old MacSHAPA files into OpenSHAPA's Ruby interface, where they can then be saved as standard OpenSHAPA files using saveDB.

Additionally, it is important to note that loadMacshapaDB will return the database as a Ruby variable that can be stored. In order to use the loaded database with any other function in the API, that database must be saved to $db. See the example below.

Parameters

Filename (String)

The filename/path of where we want to save the file.

Returns

Database

The loaded database. Save it to $db to work with it.

Project

The project information. This stores all of the plugin configuration information.

Examples

# We first have to create a string that points to the directory we want to store
# the file in.

# Load the file on the Desktop called test.opf. The tilde (~) is a shortcut
# for the current users' home directory. ~/Desktop is the current users' Desktop.
# File.expand_path is what will expand that tilde into a full path, so it is necessary.

filename = File.expand_path("~/Desktop/test.mac")

# Load the database into $db, making it accessible to all of the other functions.
# Save the project information in $pj. Saving the project information there
# is not necessary, but this way if we called saveDB after some manipulation,
# then it will be saved too.
$db, $pj = loadMacshapaDB(filename)