Create the minimal directory structure and prefs.dat for an Opera extension.

@param wuid ID of extension as known in widgets.dat
9515
private void createOEXDirectory(String wuid) throws IOException {
    File oexDirectory = new File(directory, wuid);
    if (!oexDirectory.exists() && !oexDirectory.mkdirs()) {
      throw new WebDriverException("Unable to create directory path: " + directory.getPath());
    }
    File prefsDatPath = new File(oexDirectory, "prefs.dat");
    String prefContent = String.format(WIDGET_PREFS_DAT_CONTENT, wuid);
    Files.write(prefContent, prefsDatPath, Charsets.UTF_8);
  }
636218
public DataWriterBuilder<S, D> withAttemptId(String attemptId) {
    this.writerAttemptId = attemptId;
    log.debug("With writerAttemptId: {}", this.writerAttemptId);
    return this;
  }
1120860
public UserEntity createNewUser(String userId) {
    checkAuthorization(Permissions.CREATE, Resources.USER, null);
    return new UserEntity(userId);
  }
297189
public static CliDirectory fromDef(CommandDirectoryDef def) {
        final Trie<CliDirectory> childDirectories = createChildDirectories(def);
        final Trie<CliCommand> childCommands = createChildCommands(def);
        final CliDirectory directory = new CliDirectory(def.getIdentifier(), childDirectories, childCommands);

        // Link child directories to parent.
        for (CliDirectory childDirectory : childDirectories.values()) {
            childDirectory.setParent(directory);
        }
        return directory;
    }
297789
public synchronized void delete(File dir, String id) {
        if (idToNumber.remove(id) != null) {
            save(dir);
        }
    }
1343544
function buildSandbox(id) {
    if (!has(id)) {
        throw new Error('Sandbox name is required to build a sandbox.');
    }

    // Create module instance specific sandbox
    var sandbox = {
        type: self.type,
        object: self.object,
        array: self.array,
        log: self.log
    };

    // Add extensions to sandbox
    extensions.forEach(function (extension) {
        try {

            // If extension has buildSandbox method use it to build sandbox
            if (is(extension, 'buildSandbox', 'function')) {
                extension.buildSandbox(sandbox);
            }

            // If extension has a sandbox object add it
            else if (has(extension, 'sandbox')) {
                    extend(sandbox, extension.sandbox);
                }

                // Otherwise extend the sandbox with the extension
                else {
                        extend(sandbox, extension);
                    }
        } catch (ex) {
            error('Fatal error during application initialization. ', 'Failed to build sandbox with extension "', extension, 'See following exception for more details.', ex);
            throw ex;
        }
    });

    return sandbox;
}
1236875
@Override
	public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions, ExtensionsData extension) {
		multiFilingService.addObjectToFolder(repositoryId, objectId, folderId, allVersions, extension);
	}
838172
function (manifest, file, callback) {
            generate(file.src, options, function (err, sriData) {
                // Make relative if a cwd is specified
                if (file.orig && file.orig.cwd) {
                    file.id = file.id.replace(file.orig.cwd, "");
                    sriData.path = sriData.path.replace(file.orig.cwd, "");
                }
                // Attach a property to the WIP manifest object
                manifest[file.id] = sriData;
                callback(err, manifest);
            });
        }
162328
public void createMenu(int menuId){
        mToolbar.inflateMenu(menuId);
        mMenuDataChanged = true;
        if(mAppCompatDelegate == null)
            onPrepareMenu();
    }
625978
public function createDirectory(string $id): Directory
    {
        $path = $this->getDirectoryPath($id);
        $this->filesystem->createDir($path);

        return $this->directories[$id] = new static($this->filesystem, $path, $this->format);
    }
650499
function _setDirectoryOpen(treeData, path, open) {
        var objectPath = _filePathToObjectPath(treeData, path),
            directory = treeData.getIn(objectPath);

        if (!objectPath) {
            return {
                needsLoading: true,
                treeData: treeData
            };
        }

        if (isFile(directory)) {
            return;
        }

        var alreadyOpen = directory.get("open") === true;

        if ((alreadyOpen && open) || (!alreadyOpen && !open)) {
            return;
        }

        treeData = treeData.updateIn(objectPath, function (directory) {
            if (open) {
                return directory.set("open", true);
            } else {
                return directory.delete("open");
            }
        });

        if (open && (directory.get("children") === null || directory.get("notFullyLoaded"))) {
            return {
                needsLoading: true,
                treeData: treeData
            };
        }
        return {
            needsLoading: false,
            treeData: treeData
        };
    }
288927
public static String formatMode(short mode, boolean directory, boolean hasExtended) {
    StringBuilder str = new StringBuilder();
    if (directory) {
      str.append("d");
    } else {
      str.append("-");
    }
    str.append(new Mode(mode).toString());
    if (hasExtended) {
      str.append("+");
    }
    return str.toString();
  }
1095667
private ProjectFile handleDatabaseInDirectory(File directory) throws Exception
   {
      byte[] buffer = new byte[BUFFER_SIZE];
      File[] files = directory.listFiles();
      if (files != null)
      {
         for (File file : files)
         {
            if (file.isDirectory())
            {
               continue;
            }

            FileInputStream fis = new FileInputStream(file);
            int bytesRead = fis.read(buffer);
            fis.close();

            //
            // If the file is smaller than the buffer we are peeking into,
            // it's probably not a valid schedule file.
            //
            if (bytesRead != BUFFER_SIZE)
            {
               continue;
            }

            if (matchesFingerprint(buffer, BTRIEVE_FINGERPRINT))
            {
               return handleP3BtrieveDatabase(directory);
            }

            if (matchesFingerprint(buffer, STW_FINGERPRINT))
            {
               return handleSureTrakDatabase(directory);
            }
         }
      }
      return null;
   }
51891
def create_prefix_dir(nb_file, fmt):
    """"""
    if 'prefix' in fmt:
        nb_dir = os.path.dirname(nb_file) + os.path.sep
        if not os.path.isdir(nb_dir):
            logging.log(logging.WARNING, "[jupytext] creating missing directory %s", nb_dir)
            os.makedirs(nb_dir)
32134
public static void deleteSubDirs(File dir) {
        String[] children = dir.list();
        for (int i = 0; i < children.length; i++) {
            File f = new File(dir, children[i]);
            if (f.isDirectory()) {
                deleteDir(f);
            }
        }
    }
876140
public static void mkdirs(File directory) throws CreateDirectoryException {
    if (directory.exists()) {
      // file exists and *is* a directory
      if (directory.isDirectory()) {
        return;
      }

      // file exists, but is not a directory - delete it
      if (!directory.delete()) {
        throw new CreateDirectoryException(
            directory.getAbsolutePath(),
            new FileDeleteException(directory.getAbsolutePath()));
      }
    }

    // doesn't exist. Create one
    if (!directory.mkdirs() && !directory.isDirectory()) {
      throw new CreateDirectoryException(directory.getAbsolutePath());
    }
  }
1329167
public String createSubdir() throws IOException {

        if (!saveData)
            return "";

        File dr = new File(dataRoot);
        dr.mkdirs();
        File[] rootChildren = dr.listFiles();

        int i = 1;
        while (childrenExist(rootChildren, i + ""))
            i++;

        File f = new File(dataRoot + "/" + i);
        f.mkdirs();

        currentDir = f.getAbsolutePath();
        log.info("Created training data directory: " + currentDir);

        File mov = new File(getVideoDir());
        mov.mkdirs();

        File model = new File(getModelDir());
        model.mkdirs();

        File stat = new File(getStat());
        File info = new File(getInfo());
        stat.createNewFile();
        info.createNewFile();
        return f.getAbsolutePath();
    }