Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Screenshot of app status

For general discussion related FlowStone

Re: Screenshot of app status

Postby trogluddite » Mon Aug 31, 2020 5:23 pm

MicheleANE wrote:it keeps telling me that it cannot infer base path or there is no such file to load

The methods do work correctly, but because Ruby is embedded inside FlowStone, they don't know where to search for the files.

Firstly, I'll disregard "require_relative" - it is mostly intended for use within the code of libraries so that a "parent" library file can discover any "child" library files ("cannot infer base path" is because the Ruby code is running inside FlowStone, so technically speaking there is no "parent" Ruby file).

When "require" is called, it searches all of the folders listed in an Array found in the global variable $LOAD_PATH. By default, this only includes a few folders from the FlowStone "Program Files" installation - which is not a very useful place to keep our libraries! Thankfully, the contents of $LOAD_PATH can be modified (take care that you only ever add new items to the Array, as the default folders are necessary for FlowStone to load some of its internal tools).

The code to modify the $LOAD_PATH looks something like this...
Code: Select all
# Use single-quoted Strings to allow literal back-slashes in paths.
load_folder = 'X:\foo\bar\baz'

# Take care to add each folder only once.
unless $LOAD_PATH.include?(load_folder)
  # "unshift" puts the new folder at the beginning; i.e. first searched.
  $LOAD_PATH.unshift(load_folder)
end

# Now use require as normal.
require "the_library"


If you are installing your code on multiple PCs, a useful variation is to use the "schematicLocation" method to find the folder containing the FlowStone file or exported EXE. You can then store the executable and all of its Ruby dependencies within the same folder (or local sub-folders), which may make distribution/deletion easier...
Code: Select all
load_folder = schematicLocation[:folder]
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Previous

Return to General

Who is online

Users browsing this forum: Google [Bot] and 89 guests