Coder Social home page Coder Social logo

Comments (1)

csBlueChip avatar csBlueChip commented on August 14, 2024

Hi CorruptName,

You're really welcome - so glad it has been so helpful (and popular).

The double slash is NOT a mistake, it is simply "syntactic candy".

Both Linux and Windows *1 perform an action on filespecs *2 known as "canonicalisation" [aka. c14n *3] ...This takes the filespec and reduces it to the "absolute" (or "canonical") form ...This involves:

  • [linux] replace prefixing ~ with ${HOME} [typically /home/username]
  • if the filespec does NOT start with a / *4, prefix the filespec with the current/present working directory [CWD/PWD]
  • expand environment variables (generally only performed by command line interfaces)
  • remove all occurrences of ./
  • remove all occurrences of foo/.. (where "foo" MAY be an empty string, eg. /etc/../../home/)
  • remove all occurrences of //

So. By example, these are all valid specifications for the same file:

  • Absolute paths:
    • /home/bluechip/project/file.txt [canonical form]
    • ~/project/file.txt
  • Relative paths (assuming we are sitting in /home/bluechip)
    • project/file.txt
    • ./project/file.txt
    • ../bluechip/project/file.txt
  • And...
    • ~/../bluechip//project/.////./../project/file.txt

With all that in mind, you can see that my // is perfectly legal/valid/acceptable-to-the-interpreter.

...So. The real question is: Why did I choose do it here?

You may install the Flipper devkit to any folder you wish. I had to choose an example folder for the documentation.
I chose ~/flipperZero/official/ so as to 'hint' that you may also have another folder called eg. ~/flipperZero/roguemaster/
The ~ hints that you will most likely store your copy of the FZ devkit in your home directory
...but you may well have chosen a TOTALLY different folder (eg. /var/fzdk/)
...whatever you chose as your base folder, the sub-folder for user applications is ALWAYS /application_user
...So by using the double-slash /var/fzdk // application_user I am intending to just "draw a line" (quite literally, I guess) between the first-part of the filespec which you can change as desired, and the second-part which MUST be the directory specified.

...So. You are both right and wrong ...You are right in the sense that you have correctly canonicalised the filespec I supplied ...And you are wrong in the sense that it "should be" this way; more like it "can be" this way :)

Hope that makes sense,
BC

*1 and MANY other filespec handlers
*2 A "filespec" is a filename which includes a path (and may be relative [../path ] or absolute [/path])
*3 c14n : a 'c', followed by 14 letters, followed by an 'n' ...you may also have seen "i18n", which is short for "internationalisation" [language support] by the same logic.
*4 For copyright reasons, different slashes are used by Windows [\] and Linux [/] but their function and use is the same.

from flipperzero_plugin_howto.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.