Menu

#669 New functions: 'is_dir()' and ' is_file()'

v1.1.x
closed
v1.1.4
New Functionality
2022-08-05
2022-02-18
Erik Hänel
No

Create new string functions for detecting, whether a path is (or could be) a file or a directory. The signatures are as follows:

is_dir(sPath) -> LOG
is_file(sPath) -> LOG

Analysis:

Distinguishing between files and folders is not a simple task. First thing is to ensure that the string actually follows path syntax conventions. Remember that NumeRe accepts Windows and UNIX path separators. If that is successful, one can check, if the file exists using the fileExists() function. In this case, it is a file. Otherwise, it is either not a file or it does not exist. These two cases might be separated by checking for a file extension within the last part of the string. It might also be reasonable to use another approach using wxWidgets functionalities like the wxFileName class. (see https://docs.wxwidgets.org/3.0/classwx_file_name.html)

Implementation:

  • Implementation: Wrote the functions without using the existing wxWidget functions, as these did not have the expected behavior. The strings are parsed manually and different criteria are checked, including the structure set by folder seperators / and \, and the usage of special characters.
  • Revision: [r1159]
  • Implementation test: Tested various relevant strings including special cases that could be critical for the functions. This includes network paths, foldernames that contain a "." or special path operators within the string.

Documentation:

  • [x] ChangesLog updated
  • [x] Code changes commented
  • Documentation articles:
    • [ ] corresponding documentation articles updated
    • [ ] new documentation articles created
    • [x] not needed
  • Language files:
    • [x] corresponding language files updated
    • [ ] not needed

Tests:

Both functions are part of the automatic SW tests. All deviations were resolved.

Related

Commit: [r1159]

Discussion

  • Erik Hänel

    Erik Hänel - 2022-03-18
    • labels: --> internal, strings, function
    • status: open --> accepted
    • Version: Planned --> v1.1.4
     
  • Erik Hänel

    Erik Hänel - 2022-03-21
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -2,3 +2,25 @@
    
         is_dir(sPath) -> LOG
         is_file(sPath) -> LOG
    
    +    
    +###Analysis:
    +(*Describe, what's the issue and which changes have to be made*)
    +
    +###Implementation:
    +* Implementation: (*Describe, what you've changed*) 
    +* Revision: [rXXX]
    +* Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    +
    +###Documentation:
    +* [ ] ChangesLog updated
    +* [ ] Code changes commented
    +* **Documentation articles:**
    +    * [ ] corresponding documentation articles updated
    +    * [ ] new documentation articles created
    +    * [ ] not needed
    +* **Language files:**
    +    * [ ] corresponding language files updated
    +    * [ ] not needed
    +
    +###Tests:
    +(*Describe, which tests you performed and their outcome*)
    
    • status: accepted --> analyzing
     
  • Erik Hänel

    Erik Hänel - 2022-03-24
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,7 +4,7 @@
         is_file(sPath) -> LOG
    
     ###Analysis:
    -(*Describe, what's the issue and which changes have to be made*)
    +Distinguishing between files and folders is not a simple task. First thing is to ensure that the string actually follows path syntax conventions. Remember that NumeRe accepts Windows and UNIX path separators. If that is successful, one can check, if the file exists using the `fileExists()` function. In this case, it is a file. Otherwise, it is either not a file or it does not exist. These two cases might be separated by checking for a file extension within the last part of the string. It might also be reasonable to use another approach using wxWidgets functionalities like the `wxFileName` class. (see https://docs.wxwidgets.org/3.0/classwx_file_name.html)
    
     ###Implementation:
    
     * Implementation: (*Describe, what you've changed*) 
    
    • status: analyzing --> implementing
    • assigned_to: Erik Hänel --> Raphael Zehner
     
  • Raphael Zehner

    Raphael Zehner - 2022-06-07
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -12,14 +12,14 @@
    
     * Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    
     ###Documentation:
    -* [ ] ChangesLog updated
    -* [ ] Code changes commented
    +* [ x] ChangesLog updated
    +* [x] Code changes commented
    
     * **Documentation articles:**
         * [ ] corresponding documentation articles updated
         * [ ] new documentation articles created
    -    * [ ] not needed
    +    * [x] not needed
     * **Language files:**
    -    * [ ] corresponding language files updated
    +    * [x] corresponding language files updated
         * [ ] not needed
    
     ###Tests:
    
    • status: implementing --> testing
    • assigned_to: Raphael Zehner --> Erik Hänel
     
  • Raphael Zehner

    Raphael Zehner - 2022-06-07
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -8,7 +8,7 @@
    
     ###Implementation:
    
     * Implementation: (*Describe, what you've changed*) 
    -* Revision: [rXXX]
    +* Revision: [r1159]
     * Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    
     ###Documentation:
    
     

    Related

    Commit: [r1159]

  • Raphael Zehner

    Raphael Zehner - 2022-06-07
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -12,7 +12,7 @@
    
     * Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    
     ###Documentation:
    -* [ x] ChangesLog updated
    +* [x] ChangesLog updated
    
     * [x] Code changes commented
     * **Documentation articles:**
         * [ ] corresponding documentation articles updated
    
     
  • Raphael Zehner

    Raphael Zehner - 2022-06-07
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -7,7 +7,7 @@
     Distinguishing between files and folders is not a simple task. First thing is to ensure that the string actually follows path syntax conventions. Remember that NumeRe accepts Windows and UNIX path separators. If that is successful, one can check, if the file exists using the `fileExists()` function. In this case, it is a file. Otherwise, it is either not a file or it does not exist. These two cases might be separated by checking for a file extension within the last part of the string. It might also be reasonable to use another approach using wxWidgets functionalities like the `wxFileName` class. (see https://docs.wxwidgets.org/3.0/classwx_file_name.html)
    
     ###Implementation:
    -* Implementation: (*Describe, what you've changed*) 
    +* Implementation: Wrote the functions without using the existing wxWidget functions, as these did not have the expected behavior. The strings are parsed manually and different criteria are checked, including the structure set by folder seperators / and \, and the usage of special characters.
    
     * Revision: [r1159]
     * Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    
     

    Related

    Commit: [r1159]

  • Raphael Zehner

    Raphael Zehner - 2022-06-07
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -9,7 +9,7 @@
     ###Implementation:
    
     * Implementation: Wrote the functions without using the existing wxWidget functions, as these did not have the expected behavior. The strings are parsed manually and different criteria are checked, including the structure set by folder seperators / and \, and the usage of special characters.
     * Revision: [r1159]
    -* Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    +* Implementation test: Tested various relevant strings including special cases that could be critical for the functions. This includes network paths, foldernames that contain a "." or special path operators within the string.
    
     ###Documentation:
    
     * [x] ChangesLog updated
    
     

    Related

    Commit: [r1159]

  • Erik Hänel

    Erik Hänel - 2022-08-05
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -23,4 +23,4 @@
    
         * [ ] not needed
    
     ###Tests:
    -(*Describe, which tests you performed and their outcome*)
    +Both functions are part of the automatic SW tests. All deviations were resolved.
    
    • status: testing --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB