• 请不要在回答技术问题时复制粘贴 AI 生成的内容
Aruforce
V2EX  ›  程序员

Windows 奇怪的文件系统....折腾了我一天...DEBUG 真是折磨人

  •  
  •   Aruforce · May 12, 2021 · 2164 views
    This topic created in 1853 days ago, the information mentioned may be changed or developed.
    1. 在学习 SDN 的一些东西 需要把 yang 转成 java
    2. 在一些 yang module 里面 存在一个 container 叫 aux
    3. odl 提供了些 maven plugin 支持工具
    4. 开始生成
    5. 生成过程中出现.../Aux.java IOException
    6. 开始 debug plugin 。。因为是线程池生成解析 没 debug 出来 但是确定了 大概率是 CodeGeneratorImpl 的锅
    7. 准备修改代码 改成单线程模式 确定 bug 怎么产生
    8. ODL yang-maven-plugin checkstyle 总是阻碍我打包。。总是过不了正则
    9. 准备改 yang-maven-plugin pom 修改 checkstyle 的 配置
    10. 找到一个跳过参数 -Dcheckstyle.skip=true 不合适... 我操
    11. 修改 pom 把 parent pom 的一个 plugin 修改删掉
    12. 打包 debug 。。
    13. 确定是 GenerationTask::generateFile 的问题。。但是看代码就是很基础的 FileIO 操作..不可能出问题...前面的 debug 工作 都是无用功。。
    14. 误修改把 aux 改成了 apx 。。又试了一下生成
    15. 卧槽。。。这是为啥???
    16. 写个测试代码
    import java.io.File;
    import java.io.IOException;
    
    public class Test {
        private static final String file_str = "E:\\WorkSpace\\yang2java\\target\\generated-sources\\mdsal-binding\\org\\opendaylight\\yang\\gen\\v1\\urn\\ct\\yang\\snc\\ct\\tty\\rev200305\\vty\\tty\\Avx.java";
        public static void main(String[] args) throws IOException {
            File file = new File(file_str);
            String parent = file.getParent();
            File dir = new File(parent);
            if (!dir.exists()){
                boolean mkdirs = dir.mkdirs();
                System.out.println("dirs create = " +mkdirs);
            }
            if (!file.exists()){
                boolean newFile = file.createNewFile();
                System.out.println("newFile create = " + newFile);
            }
        }
    }
    
    
    1. 一路 debug ... 到了 Java Native 卧槽 不行...
    2. 手动建立 Aux.java-->windows alert 指定的设备名无效..
    3. 目录的问题?切目录。。也不行
    4. 搜索·指定的设备名无效·
    5. 出现这个 https://iknow.lenovo.com.cn/detail/dc_154023.html
    6. 测试搜索结果。。confirmed...
    7. 转去服务器生成...

    你 M 的 debug 路程太曲折了

    3 replies    2021-05-12 17:21:39 +08:00
    nznd
        1
    nznd  
       May 12, 2021
    用 everything 搜了一下 R 的 lib 文件夹里用 aux_ 避免了这个问题...
    nightwitch
        2
    nightwitch  
       May 12, 2021   ❤️ 1
    aux,con 之类的都是 windows 的保留名字, 为了兼容远古的 DOS,这些限制是在 Windows 内核里的,和文件系统的关系不大。

    Linux 下你也不能建立一个以`/` 字符开头的文件,每个平台有每个平台的特定规则。
    Aruforce
        3
    Aruforce  
    OP
       May 12, 2021 via Android   ❤️ 1
    @nightwitch / 这个很容易看出来啊……aux 我是联想不到 windows 保留字…
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   956 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 20:00 · PVG 04:00 · LAX 13:00 · JFK 16:00
    ♥ Do have faith in what you're doing.