@@ -56,17 +56,14 @@ export const CLASS_NAME_ROBOT = 'Robot';
5656export const CLASS_NAME_TELEOP = 'Teleop' ;
5757
5858// The extension of all JSON files is .json.
59- export const JSON_FILE_EXTENSION = '.json' ;
59+ const JSON_FILE_EXTENSION = '.json' ;
6060
6161// The extension of a downloaded project is .blocks.
6262export const UPLOAD_DOWNLOAD_FILE_EXTENSION = '.blocks' ;
6363
6464// The file name of the project info file.
6565const PROJECT_INFO_FILE_NAME = 'project.info.json' ;
6666
67- // The file name of the project info file.
68- const ROBOT_MODULE_FILE_NAME = 'Robot.robot.json' ;
69-
7067// A project name starts with an uppercase letter, followed by alphanumeric characters.
7168const REGEX_PROJECT_NAME_PART = '[A-Z][A-Za-z0-9]*' ;
7269
@@ -81,9 +78,9 @@ const REGEX_MODULE_TYPE_PART = '\.(robot|mechanism|opmode)';
8178
8279export const PROJECTS_DIRECTORY_PATH = '/projects/' ;
8380
84- // This regex is used to extract the project name and file name from a file path.
81+ // This regex is used to extract the project name from a file path.
8582const REGEX_FILE_PATH = '^' + escapeRegExp ( PROJECTS_DIRECTORY_PATH ) +
86- '(' + REGEX_PROJECT_NAME_PART + ')/( .*' + escapeRegExp ( JSON_FILE_EXTENSION ) + ') $' ;
83+ '(' + REGEX_PROJECT_NAME_PART + ')/.*' + escapeRegExp ( JSON_FILE_EXTENSION ) + '$' ;
8784
8885// This regex is used to extract the class name from a module path.
8986const REGEX_MODULE_PATH = '^' + escapeRegExp ( PROJECTS_DIRECTORY_PATH ) +
@@ -192,18 +189,6 @@ export function getProjectName(filePath: string): string {
192189 return result [ 1 ] ;
193190}
194191
195- /**
196- * Returns the file name for given file path.
197- */
198- export function getFileName ( filePath : string ) : string {
199- const regex = new RegExp ( REGEX_FILE_PATH ) ;
200- const result = regex . exec ( filePath )
201- if ( ! result ) {
202- throw new Error ( 'Unable to extract the file name from "' + filePath + '"' ) ;
203- }
204- return result [ 2 ] ;
205- }
206-
207192/**
208193 * Returns true if the given file name is a valid module file name.
209194 */
0 commit comments