jonataslaw/get_cli

When using the command 'get create page:xxx on xxxx', it does not correctly generate the code in the specified directory

xuxiaofan1101 opened this issue · 1 comments

├─app
│ ├─modules
│ │ ├─common
│ │ │ └─popup_menu
│ │ │ ├─add_contacts
│ │ │ │ └─friend
│ │ │ ├─new_group
│ │ │ ├─new_server
│ │ │ └─scan
│ │ ├─contacts
│ │ ├─discover
│ │ ├─message
│ │ │ ├─channel_list
│ │ │ ├─chat_details
│ │ │ ├─message_list
│ │ │ └─model
│ │ ├─mobile_navigation
│ │ ├─my
│ │ │ └─model
│ │ └─pc_navigation
│ └─routes
├─components
├─middleware
└─widget
this is my code directory。When I execute the command 'get create page:friend on contacts', the generated code is placed in the 'app/modules/common/popup_menu/add_contacts' directory, instead of the 'app/modules/contacts' directory where I expect it to be.
Is this a problem?

  static FileModel model(String? name, String command, bool wrapperFolder,
      {String? on, String? folderName}) {
    if (on != null && on != '') {
      on = replaceAsExpected(path: on).replaceAll('\\\\', '\\');
      var current = Directory('lib');
      final list = current.listSync(recursive: true, followLinks: false);
      final contains = list.firstWhere((element) {
        if (element is File) {
          return false;
        }

        return '${element.path}${p.separator}'.contains('$on${p.separator}');
      }, orElse: () {
        return list.firstWhere((element) {
          //Fix erro ao encontrar arquivo com nome
          if (element is File) {
            return false;
          }
          return element.path.contains(on!);
        }, orElse: () {
          throw CliException(LocaleKeys.error_folder_not_found.trArgs([on]));
        });
      });

因为检测的方法是使用contains的.所以就可以存在路径冲突