Yes, you corrected it a bit…
Please don’t use file separators directly, but let Ruby do it because it knows better all edge cases: file = File.join(PLUGIN_ROOT, "shadows.rb")
By the way, \s is a short hand for a space character. \ is an escape sign that is used to express control characters (line breaks etc.) with non-control characters. That’s why I suggested \ should not be used in file paths, otherwise you have to escape it as \\ (and in some situations even \\\\ or \\\\\\\\).
There must be a good reason why all the internet uses / as separator…
Warnings can be ignored (they don’t interrupt execution of the code). If you find it annoying you can avoid the situation by checking first if the constant has already been defined:
That’s because PLUGIN_ROOT is assigned outside the part of the code protected by the if not (file_loaded? file) clause. The assignment is therefore executed again each time you load whatever file this snippet is from. Ruby will warn when you assign a value to a constant that already exists - even if it is the same value.
It isn’t clear to me why you are re-running this snippet. If you are doing it manually while testing out code, you could just ignore the warning. Or you could make that statement conditional: