Skip to content

Conversation

@namsonx
Copy link
Collaborator

@namsonx namsonx commented Sep 20, 2023

No description provided.

Copy link
Collaborator

@HolQue HolQue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Son,

relative paths work now!!

But please replace:

jFile=jFile.strip()

if not re.match("^[a-zA-Z]:",jFile) and not re.match("^[\\/]",jFile):
    jFile = CString.NormalizePath(jFile)

if  not(os.path.isfile(jFile)):
    raise Exception(f"File '{jFile}' is not existing!")

self.lImportedFiles.append(jFile)
self.jsonPath = os.path.dirname(jFile)

try:
    sJsonData= self.__load_and_removeComments(os.path.abspath(jFile))

with something like:

# at first normalize:
jFile = CString.NormalizePath(jFile) # (NormalizePath does also the jFile.strip() for you ;-)

# at second check existence
if  not(os.path.isfile(jFile)):
    raise Exception(f"File '{jFile}' is not existing!")

# only if file exist, further checks makes sense:
if not re.match("^[a-zA-Z]:",jFile) and not re.match("^[\\/]",jFile):
   # further consequences if required

self.lImportedFiles.append(jFile)
self.jsonPath = os.path.dirname(jFile)

try:
    sJsonData= self.__load_and_removeComments(jFile) # jFile is already normalized, therefore os.path.abspath is not necessary

@test-fullautomation test-fullautomation added enhancement New feature or request 0.9.0 labels Sep 20, 2023
@test-fullautomation test-fullautomation added this to the 0.9.0 milestone Sep 20, 2023
Copy link
Owner

@test-fullautomation test-fullautomation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Son,
very good.
Please consider Holgers finding and provide as soon as possible a new pull-request.,
Thank you,
Thomas

@namsonx
Copy link
Collaborator Author

namsonx commented Sep 20, 2023

Hello Holger,

Thank you for your comments!

Hello Thomas, I have just updated the pull-request.

Thank you,
Son

@HolQue
Copy link
Collaborator

HolQue commented Sep 20, 2023

Hi Son,

what is this:

jFile = CString.NormalizePath(jFile.strip())

?

I already mentioned several times now: NormalizePath does a strip() also. Therefore no need to do this when calling NormalizePath().

Please consider my previous comment:

# at first normalize:
jFile = CString.NormalizePath(jFile) # (NormalizePath does also the jFile.strip() for you ;-)

@namsonx
Copy link
Collaborator Author

namsonx commented Sep 20, 2023

Hello Holger,

Sorry for the mistake! I've done it as a habit.
I remove .strip()

Thank you,
Son

@test-fullautomation
Copy link
Owner

Hi @namsonx ,
what is the status of this ticket?
Thank you,
Thomas

Copy link
Owner

@test-fullautomation test-fullautomation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Son,
merged after discussion with Holger,
Thank you,
Thomas

@test-fullautomation test-fullautomation merged commit fa35abe into develop Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.9.0 enhancement New feature or request

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants