Skip to content

Conversation

DeathFishAtEase
Copy link
Collaborator

@DeathFishAtEase DeathFishAtEase commented Sep 10, 2025

改进从 INI 中读取 .shp 文件名的方式

The original processing method would check if there is a file extension. If not, it would automatically add the .shp extension to read. This is a good safeguard, but there are two problems:

原先的处理方式会检查是否有后缀名,如果没有,那么会自动补上 .shp 后缀来读取,这是一个不错的保障手段,但是存在两个问题:

  1. It only strictly checks for lowercase .shp, meaning that RING1.SHP would be considered as having no extension, so it would automatically add to become RING1.SHP.shp for reading.

    只严格检查小写 .shp,也就是说 RING1.SHP 会被视为 没有 后缀,因此自动补充为 RING1.SHP.shp 来读取,

  2. It does not strictly check whether it is an extension, meaning that .shp.RING2 would be considered as having an extension, so it would not add, and actually try to read a file named .shp.RING2, rather than .shp.RING2.shp.

    不严格检查是否为后缀,也就是说 .shp.RING2 会被视为 已有 后缀,不会补充,并真的去读取名为 .shp.RING2 的文件,而不是 .shp.RING2.shp

Now, some improvements have been made so that uppercase .SHP is not considered as having no extension, and at the same time, cases where .shp is not at the end are no longer considered as having an extension.

现在对它们进行了一些改进,使得大写 .SHP 不会 被视为 没有 后缀,同时 不再.shp 不在末尾的情况视为 已有 后缀。

Expected effect of the current changes (PDFXLOC (red) as the original incorrect effect, RING1 (blue) as the expected correct effect):

当前更改的预期效果(PDFXLOC(红)作为原始的错误效果,RING1(蓝)作为预期的正确效果):

RING1 SHP RING2 shp A
  • Test has passed.

测试通过。

@github-actions github-actions bot added the Minor Minor feature and/or fix, not a lot of changes or they are not significant label Sep 10, 2025
Copy link

github-actions bot commented Sep 10, 2025

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Metadorius
Copy link
Member

Is this bug also present in 0.4?

@DeathFishAtEase
Copy link
Collaborator Author

DeathFishAtEase commented Sep 11, 2025

Is this bug also present in 0.4?

Yes, version 0.4 (RC1) also has this issue. I just verified using [DefaultDigitalType] -> Shape=digits.SHP, and using cscheme, I batch-converted the colors of the sample file we provided and saved it as digits.shp.shp.

  • On the left, SMCV shows the working effect with lowercase .shp, which is the expected effect;
  • On the right, AMCV shows the actual effect with the .SHP notation.

If a file named digits.shp.shp is not created for reading, it will fall back to TEXT mode for display due to no available file.

digits

@DeathFishAtEase DeathFishAtEase added the Bugfix This is a bugfix that does not need documentation beyond mention in changelog label Sep 11, 2025
@Coronia Coronia merged commit 5764059 into Phobos-developers:develop Sep 12, 2025
8 of 9 checks passed
DeathFishAtEase added a commit that referenced this pull request Sep 12, 2025
> 改进从 INI 中读取 `.shp` 文件名的方式

The original processing method would check if there is a file extension.
If not, it would automatically add the `.shp` extension to read. This is
a good safeguard, but there are two problems:
> 原先的处理方式会检查是否有后缀名,如果没有,那么会自动补上 `.shp` 后缀来读取,这是一个不错的保障手段,但是存在两个问题:

1. It only strictly checks for lowercase `.shp`, meaning that
`RING1.SHP` would be considered as *having **no** extension*, so it
would automatically add to become `RING1.SHP.shp` for reading.
> 只严格检查小写 `.shp`,也就是说 `RING1.SHP` 会被视为 **没有** 后缀,因此自动补充为 `RING1.SHP.shp`
来读取,

2. It does not strictly check whether it is an extension, meaning that
`.shp.RING2` would be considered as *having **an** extension*, so it
would not add, and actually try to read a file named `.shp.RING2`,
rather than `.shp.RING2.shp`.
> 不严格检查是否为后缀,也就是说 `.shp.RING2` 会被视为 **已有** 后缀,不会补充,并真的去读取名为 `.shp.RING2`
的文件,而不是 `.shp.RING2.shp`。

Now, some improvements have been made so that uppercase `.SHP` is
***not*** considered as *having **no** extension*, and at the same time,
cases where `.shp` is not at the end are ***no longer*** considered as
*having **an** extension*.
> 现在对它们进行了一些改进,使得大写 `.SHP` **不会** 被视为 **没有** 后缀,同时 **不再** 将 `.shp`
不在末尾的情况视为 **已有** 后缀。

Expected effect of the current changes (`PDFXLOC` (red) as the original
incorrect effect, `RING1` (blue) as the expected correct effect):
> 当前更改的预期效果(`PDFXLOC`(红)作为原始的错误效果,`RING1`(蓝)作为预期的正确效果):

<img width="736" height="613" alt="RING1 SHP"
src="https://github.com/user-attachments/assets/470f5dd2-8290-45bc-8966-2ce436ebe20b"
/>
<img width="736" height="613" alt="RING2 shp A"
src="https://github.com/user-attachments/assets/fb54ce79-d725-4306-bc97-59ad72e8e2af"
/>

- [x] Test has passed.
> 测试通过。
@DeathFishAtEase DeathFishAtEase deleted the Auto-Fill-file-extension branch September 12, 2025 11:11
DeathFishAtEase added a commit to DeathFishAtEase/Phobos that referenced this pull request Sep 12, 2025
DeathFishAtEase added a commit to DeathFishAtEase/Phobos that referenced this pull request Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix This is a bugfix that does not need documentation beyond mention in changelog Minor Minor feature and/or fix, not a lot of changes or they are not significant

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants