Mistakes I’ve made treating file paths as stringsMarch 10th [email protected] philnash Phil Nash Developer evangelist for Twilio and Authy.
File paths look like strings.
For example:require “pathname” path1 = Pathname.new( “path” ) path2 = Pathname.new( “to” ) path1 + path2 # => #Pathname ` objects have a ` + ` operator that concatenates the paths, much like ` + ` concatenates strings.
In fact, it also works with a mix of strings and paths: As you can see “ objects have a “ operator that concatenates the paths, much like “ concatenates strings.
Always use the built in path toolsWhether you’re working in Node.js, Ruby, or any other language do not be tempted to treat file paths as strings.

Comments to: Mistakes I’ve made treating file paths as strings

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

Login

Welcome to Typer

Brief and amiable onboarding is the first thing a new user sees in the theme.
Join Typer
Registration is closed.